Margin
The <p> label is used in the section in the div css layout. You can use the margin label to define the style for the upper, lower, and left spaces (indentation) of the section. Margin is defined in the upper, lower, left, and right directions. Normally, we can use a line to describe the style we need.
Example: margin: 20px 8px 8px 20px;
This statement represents: margin-top; margin-right; margin-bottom; margin-left.
The order of the four values is: top, right, bottom, left. It is the clockwise direction starting from.
We can optimize the optimization for the consistency between upper and lower values and between left and right values.
Can be written as: margin: 20px 8px;
This statement indicates the upper, lower, and left.
Text-align, for example, text-align: center, is generally used for text align in a paragraph.
The following example shows different paragraph la S:
| The code is as follows: |
Copy code |
<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Strict // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <Html xmlns = "http://www.w3.org/1999/xhtml"> <Head> <Meta http-equiv = "Content-Type" content = "text/html; charset = utf-8"/> <Title> </title> <Style type = "text/css"> <! -- Div { Width: 500px; Background: # ccc; } P { Border: 1px solid red; Background: # fff; } # P1 { Margin: 20px 8px 8px 20px. Right. . Left */ Text-align: center; } # P2 { Margin: 20px 8px. Left and Right */ Text-align: right; } # P3 { Margin: 20px;/* All sides are */ Text-align: left; } --> </Style> </Head> <Body> <Div> <P id = "p1">-Div CSS layout section layout method </p> <P id = "p2">-Div CSS layout section layout method </p> <P id = "p3">-Div CSS layout section layout method </p> </Div> </Body> </Html>
|
Padding
We can use padding to implement the blank section. Some attributes of padding are similar to those of margin.