Elements of CSS control positioning

Source: Internet
Author: User
Tags visibility

Core Tip:In addition to controlling the position of the upper left corner of the positioning element, you can also control the width and height of the elements and the visibility of the elements in the page.

In addition to controlling the position of the upper left corner of the positioning element, you can also control the width and height of the elements and the visibility of the elements in the page.


Width

The elements that are positioned are still displayed from left to right as they appear on the page. By using the width attribute, you can set the limit of the character's flow to the right, that is, the width of the setting element.

DIV {position:absolute; left:200px; top:40px; width:150px}

When the browser receives this rule, it displays the text in accordance with the rules, and limits the maximum horizontal size of the paragraph to 150 pixels.

Width attributes apply only to elements of absolute positioning. You can use any of the length units we have learned, or use proportional values to set the width, and the proportional value refers to the ratio of the parent element.

In IE6, this property can also be used for images. You can artificially widen or compress images by width setting.

Height

Theoretically, the height should be similar to the width setting, except in the vertical direction:

DIV {position:absolute; left:200px; top:40px; height:150px}

Here I use "theoretically", because the most commonly used browsers do not support height attributes. (You can only set elongated images in IE 4 height.) )

Visibility of

With CSS, you can hide elements and make them invisible on the page. This property applies to both positioned and not positioned elements.

H4 {Visibility:hidden}

I'd like to show you an example, but, because I want to make it invisible, what do you see in this example?

Options:

Visible enables elements to be seen


Hidden the elements to be hidden


Inherit means that it will inherit the visual setting of the parent element.


When an element is hidden, it still occupies the original space in the browser window. So, if you surround text with a hidden image, it will be displayed with text surrounding a blank area.

This property is useful when writing languages and using dynamic HTML, such as you can make a paragraph or image appear only when the mouse is slippery.

Communicator does not support visibility properties. Only IE 4 of users can enjoy its beauty!



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.