Why does CSS need to be suspended

Source: Internet
Author: User

1. For a capacity

Let's say we ask for a 100px width on the left. Requires that the right side be expanded freely with the browser.

If the width of this 100px is an IMG, the cross-inside element. The right side is also a horizontal element, and the block-level elements are different.

2. Text wraps around the picture.

There's an IMG under the DIV and a span tag.

IMG is best suspended, although the suspension is said to be out of the document, but still occupy space.

So the problem in span can surround him.

or div under an IMG tag, and then a bunch of text also line, specific to see themselves.

3. Float can help us to better and faster layout.

Not to say our margin-right:0px, this is not to replace our float:right;

Margin tends to be more about relationships with surrounding elements.

4. There is also a little position in the use of relative and position:

Preferably a relative, then the next layer of absolute, and then the next layer relative.

If the direct relative then the next layer of absolute is not effective.

5. We note that usually the outermost we all need a layout of the Div, and then there is a positioning div, we generally rarely in the layout of the div use padding or margin because such a child or unconsciously change the size of the layout div, we are generally within the element inside the use, This changes the width and height of an element inside, but it is not related to the layout outside.

6.span label If there is no float and right float, his line-height is different. If not, the Line-heigh may be void.

7. Inline-block

Http://www.111cn.net/cssdiv/163/54664.htm

Http://www.cnblogs.com/KeithWang/p/3139517.html

8. The height of a div is not set, if there is an IMG can support him, but if the IMG is Float:left, this will not be high.

So if the height of a suspended element is greater than the height of the outer div setting, then the DIV will not be propped up. So the inner element may overwrite the outer border of the DIB.

9. Why should the suspension be cleared?

For example, a side element, the first internal element is set to hover, then the second inner element will also be affected.

10. If the child element is FLOAT3 or more than 3, be sure to consider setting the height of the parent element.

11.

If you want to center the hairs, you must fill in the text-align on the parent element.

Text-indent:2em, which is useful for P tags, but does not know how to invalidate the span.

13.float is just out of the document stream, but he doesn't occupy a highly

However, if the sibling element has a set height, the suspension will not go up.

14.

Here we can be similar to the previous IMG for float, no clear suspension, then the bottom of the suspension, the UL height is 0, the width is 0, the following Li did not write float:left; maybe auto-hover,

The main thing we need to pay attention to is that the solution is, behind the UL we also set the suspension, and then Li also set the suspension, suspended in the suspension, is not required to clear such operations.

15. From the above example, we can see that the problem of capacity,

The left 100px adapts automatically to the right.

A. We left a DIV left suspended, a div on the right is also left suspended, and then inside ul. Li left I suspended so that the distance is not enough, he automatically next line.

B. If left a DIV is not suspended, width 100px, a div on the right, and then float:right;

The right side of the left on the line, whether suspended or not suspended, not enough automatic line.

This is the same as a, the div on the right can be set to width, percentage, or PX.

On the left, in fact, all the same.

Block-level elements because the suspension can float up. This can't forget the amount. Of course

C. Regardless of what is left, the parent element is set relative, child element, Position:absolute, and then margin-left:100px;

D.

Why does CSS need to be suspended

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.