Html basics (1): Practical CSS labels and attribute values

Source: Internet
Author: User

I. In the preliminary HTML development stage, the content structure of the entire webpage must be analyzed first: that is, the webpage content should be classified in general, such as nav content foot, each type must have a special Div

Ii. Common CSS labels and attributes:

1. Width: width. Its value can be:

(1) Auto, width = width of the parent label

(2) xx %. The current tag width is XX % of the parent tag.

(3) Px, fixed Label Size

(4) inherit: inherits the value of the parent tag.

Note: The difference between auto and 100%: The width obtained by auto is the content width + the width of margin; 100%, it only contains the content width, does not contain margin, so sometimes 100% is used, the last Div may be larger.

2. Make the background transparent: filter: alpha (opacity = 30 );

3. Border prototype: Border: width style color. You can set the Border Value in sequence.

(1) The following values can be obtained for a style:

4. margin,

(1) note that after the relative sides of the "Up and down" elements are set to margin, their distance is the maximum value of margin,

Eg: div1 on, margin-Right = 50

Div2 down, margin-Left = 60

Therefore, the distance between div1 and div2 is not 50 + 60 = 120, but the maximum value of margin is 60. This fusion will invalidate margin-right.

5. Hide the scroll bar: overflow-X: hidden,

(1) This setting can only take effect after being added to the body.

(2) An important application of this nature is the ability to drag the screen and slide between the left and right.
6. Text-align: horizontal alignment of items with pictures and fonts, such as text, images, and links. Optional values include left, center, and right.

7. It is relatively easy to directly use text-align: center to make a text in the horizontal center. However, to make it in the vertical center, you can only use padding margin and other methods.

8. If the background is a monochrome image, we can cut the image into a few pixels and set Background: URL (XX) Repeat;

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.