i
What Do You Mean By HTML and CSS?
Common HTML Terms
Creating HTML Document Structure
Common CSS Terms
Selectors
Referencing CSS
CSS Resets
Getting to Know HTML And Semantics Overview
Identifying Divisions and Spans
Using Text Based Element
Building Structure
Creating Hyperlinks
Getting to Know CSS :The Cascade
Calculating Specificity
Combining Selectors
Layering Styles With Multiple Classes
Common CSS Properties
CSS Aural Media/Style Sheets
CSS Pagination
CSS Overflow
CSS White Space
CSS Word Wrap
CSS Outline
CSS Visibility
CSS Counters
CSS Animation
CSS Transition
CSS Tooltips
CSS Tooltip Animation
CSS Arrow
CSS Flexbox
CSS Media Queries
CSS 2D Transforms
CSS 3D Transforms
How are Elements Displayed?
Display Property Controls And Box Model?
Working With Box Model
Width and Height
Margins and Padding
Borders, Individual Border Sides, Border Radius, Box Sizing, Content Box and Padding Box
Developer Tools
Removing Spaces between Inline-Block Elements
Positioning With Floats
Floats in Practice
Positioning With Inline-Block
Clearing and Containing Floats
Creating Reusable Layouts
Uniquely Positioning Layouts
Adding Colour To Text
Changing Font Properties
Font Family
Font Size, Font Style, Font Variant, Font Weight And Line Height
Shorthand Font Properties
Applying Text Properties
Text Properties All Together
Using Web-Safe Fonts
Including Citation And Quotes
Adding A Background Colour
Adding a Background Image and Background Repeat
Background Position and Shorthand Background Image Values
Designing Gradient Backgrounds
Changing the Direction of a Gradient Background
Using Multiple Background Images
Exploring New Background Properties
Unordered Lists
Ordered Lists
Description Lists
Nested Lists
List Item Styling
List Style Type Values
List Style Position Property
Adding Media And Adding Images
Sizing Images
Positioning Images, Inline Positioning Images, Blocking Positioning Images , Positioning Images Flush Left or Right
Adding Audio
Adding Videos
Adding Inline Frames
Semantically Identifying Figures And Captions
Building Forms And Initializing a Form
Text Fields And Text Areas
Multiple Choice Inputs And Menus
Form Buttons
Other Inputs
Organizing Form Element
Form And Input Attributes
Login Form Example
Organizing Data with Tables
Creating A Table
Table Header
Table Structure
Table Head, Body and Foot
Combining Multiple Cells
Table Borders
Table Striping
Aligning Text
Completely Styled Table
HTML Coding Practices
Use the Proper Document Structure
Keeping the Syntax Organized
Use Practical ID and Class Values
CSS Coding Practices
Write CSS Using Multiple Lines and Spaces
Use Proper Class Names
Build Proficient Selectors
Use Desired Classes When Needed
Use Shorthand Hexadecimal Color Values
Drop Units Zero Values
HTML abbr tag
HTML acronym tag (Not for HTML 5)
HTML area tag
HTML basefont tag
HTML blockquote tag
HTML datalist tag
HTML Description List
HTML ins tag
Marquee HTML Tag
HTML object tag
HTML picture tag
HTML SVG
Contingent upon the element, the browsers might provide pre-defined paddings and margins to the element to help with clarity and legibility. We will come across this with text-based elements. The pre-defined margins, as well as padding for these elements, might vary with different browsers and elements. In the first chapter, we talked about CSS reset to condition these default values down to zero. Doing so enables us to work starting from the earliest stage and to indicate our very own values.
Margins
The margin property enables the user to set the measure of the space that encompasses an element. Margins are completely transparent, and it falls outside of the border for an element. Look at one of its examples:
div {
margin: 20px;
}
Padding
The property of padding is much similar to that of the property of margin; the ‘padding’ property provides the spacing straightforwardly within an element. Check the code:
div {
padding: 20px;
}
Unlike the margin property, this padding property works vertically on inline-level elements.
Margin and Padding declarations
CSS offers us the ability to provide values to properties in different ways. We can utilize the shorthand process i.e., listing a couple of values with one property. Or we can also go with the longhand property i.e., listing several values and properties one after the other. It is important to note that whatever be the case, one should use the right format for value and properties.
The 'padding,' as well as the 'margin' properties, comes under both the shorthand and the longhand category. While dealing with the shorthand 'margin' property, we define only one value.
div {
margin: 20px;
}
To provide one value to both top and bottom, and a different value to both right and left side of an element, define the 'margin' property with two values: one for top and bottom and the other for left and right. In the example below, we are keeping the margin of top and bottom as 10 pixels and that of left and right as 20 pixels.
div {
margin: 10px 20px;
}
If you want to give unique values to all the four sides of the element, then write all the value in the order as top, right, bottom, and left. In the below example, we are giving 10 pixels on top, 20 on the right, 0 on the bottom, and 15 on the left.
div {
margin: 10px 20px 0 15px;
}
Utilizing the padding and the margin property alone with any number of qualities is known as shorthand. With the help of longhand, we can set the one side value at a time. The property name and the side where the property needs to be applied is connected with a dash. Example – 'padding-right' will acquire only one value and will set the right padding for that element. The same method goes with the margin as well.
div {
margin-top: 10px;
padding-left: 6px;
}
Don't miss out!