Explanation Lesson #5
Create a Website with HTLM5 and CSS
main h2 { font-size:22px; text-align:center; color:#99ccff; text-shadow:1px 1px 2px #000; margin:1% 0; } main p { text-align:left; text-indent:1rem; margin:1% 0}
The first block of code defines the h2 tag.
font-size:22px;Sets the font size to 22 pixels
text-align:center;Aligns it to center of available space
color:#99ccff;Defines forecolor as blue in hexidecimal code
text-shadow:1px 1px 2px #000;Adding text shadow can make text look 3 dimensional. It does work better with lighter colors. In many cases hexidecimal code can be expressed in 3 digits (actually RGB). Black would be #000 , white would be #fff
margin:1% 0;Margins create space on the outside of the element (padding - inside). In this case it's 1% top and bottom and zero left and right. Use margins to create white space between elements. Lack of white space will make your pages harder to read.
The second block of code further defines our paragraph tag. Font family and size were defined in the body declaration in the top of the style sheet.
text-align:left;Aligns text to the left of the page
text-indent:1rem;Indents the first line of text 16 pixels. (more white space)
margin:1% 0once again we add a 1% margin top and bottom for more white space.