A method of div+css a paragraph in the layout of a Web page

Source: Internet
Author: User

The paragraph in the DIV+CSS layout uses the <p> label, and the margin label defines the style for the upper and lower margins of the paragraph (indentation). Margin is defined as the top, bottom, left, and right four directions, and normally we can use one line to describe the style we need.

Example: margin:20px 8px 8px 20px;

This sentence is expressed separately: Margin-top;margin-right;margin-bottom;margin-left.

The order of the four values is: top, right, bottom, and left. It's the clockwise direction starting 12:00.

How the values are consistent and the values are the same, we can optimize them again.

Can be written as: margin:20px 8px;

This sentence is divided into: up and down, around.

For the text alignment within the paragraph, generally use text-align, such as: Text-align:center;

The following are examples of different paragraph layouts:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>www.bianceng.cn - 编程入门网</title>
<style type="text/css">
<!--
div {
 width:500px;
 background:#ccc;
}
p {
 border:1px solid red;
 background:#fff;
}
#p1 {
 margin: 20px 8px 8px 20px;/*上。右。下。左*/
 text-align:center;
}
#p2 {
 margin: 20px 8px;/*上下。左右*/
 text-align:right;
}
#p3 {
 margin: 20px;/*四边均是*/
 text-align:left;
}
-->
</style>
<body>
<div>
<p id="p1">jzxue.com - Div CSS布局 段落布局方法</p>
<p id="p2">jzxue.com - Div CSS布局 段落布局方法</p>
<p id="p3">jzxue.com - Div CSS布局 段落布局方法</p>
</div>
</body>

Related Article

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.