Lecture
Today I will tell you how to format all the elements of the post, for this you only need the style.css file. Open it in the editor and get started.
Get rid of most margins and paddings - enter the following code above body {} in style.css :
one 2 3 four | body, h 1 , h 2 , h 3 , h 4 , h 5 , h 6 , blockquote, p { margin : 0 ; padding : 0 ; } |
By the way, I usually say, put this or that, above or below this or that. Know that this is optional. You can paste the code where you need it. I just cite as an example my own way of organizing code.
Give the H1 style a heading, insert these lines under the body {} :
one 2 3 four five | h 1 { font-family : Georgia, Sans-serif ; font-size : 24px ; padding : 0 0 10px ; } |
Paste the following code under #container {} (save the changes and update the browsers after entering each block of code to see the changes step by step):
one 2 3 | .post { padding : 10px 0 10px 0 ; } |
You have added 10-pixel padding at the top and bottom of each DIV with the post class.
one 2 3 four | .post h 2 { font-family : Georgia, Sans-serif ; font-size : 18px ; } |
.post h2 is not a general rule. It is aimed specifically at the H2 subtitles inside the post DIV. This does not affect the H2 subheadings in the sidebar. This is called style inheritance .
one 2 3 | .entry { line-height : 18px ; } |
We have increased the line spacing inside the post block.
Insert these lines under a: hover {} :
one 2 3 | p { padding : 10px 0 0 0 ; } |
10-pixel upper indent for each paragraph tag.
Paste under .entry {} :
one 2 3 four | p.postmetadata { border-top : 1px solid #ccc ; margin : 10px 0 0 0 ; } |
Remember the paragraph tag with the postmetadata class? Styling a separate paragraph tag and a DIV is almost the same. You can assign a frame (border), padding (margin and padding) and background (background) to any of the tags.
To the postmetadata paragraph tag you have added a gray frame and a 10-px upper indent to it.
border-top means only the top of the frame. border-left means only the left side of the frame, etc. Only border , without -top , -right , -bottom or -left means a frame on all sides. For example, border: 1px solid #ccc; This means that you have applied a gray color and a width of 1 pixel to all four sides of the frame.
Paste this code under p.postmetadata {} :
one 2 3 four five 6 | .navigation { padding : 10px 0 0 0 ; font-size : 14px ; font-weight : bold ; line-height : 18px ; } |
Test case: for DIV, a navigation that includes the Next page and Previous page links , we just:
That's all for today. If something is not clear or I have poorly explained - write in the comments.
Comments
To leave a comment
Content Management Systems (CMS)
Terms: Content Management Systems (CMS)