CSS practice
CSS practice
CSS SELECTORS
5 selectors
-simple selectors (select elements based on name, id, class)
-combinator selectors (select elements based on a specific relationship between them)
-Pseudo-class selectors(select elements based on a certain state)
-pseudo-elements selectos (select and style a part of an element)
-Attribute selectors(select elements based on an attribute or attibute value)
In this example only <p> elements with class=”center” will be red and center-aligned:
P. center{
Text-align: center;
Color: red;
}
MARGINS
Margin properties are used to create space around elements, outside of any defined borders.
margin-top
margin-right
margin-bottom
margin-left
Shorthand property
PADDING
Padding properties are used to generate space around an element’s content, inside of any
definded borders.
To keep the width at 300px, no matter the amount of padding, you can use the box-sizing property.
This causes the element to maintain its actual width; if you increase the padding, the available
content space will decrease.