How to typeset paragraphs in div css webpage layout

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.