Home >Web Front-end >HTML Tutorial >A css compatibility issue caused me to think about the DIV position. I hope you can help me! ! _html/css_WEB-ITnose

A css compatibility issue caused me to think about the DIV position. I hope you can help me! ! _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:15:17795browse

Today I encountered a CSS compatibility issue. The problem post is at: http://topic.csdn.net/u/20120927/09/f8d698ba-1640-4cda-8823-c1eca22e5730.html

Specially I would like to ask everyone here if there is any situation that would lead to the following situation:


Both div1 and div2 are in large DIVs. Now there is a problem: div2 is aligned to div1, that is, from div1 Start the arrangement. The content, height and width of div1 have been defined. Why does this happen to div2? Can anyone tell me under what circumstances this situation would occur and how to solve it?


Reply to the discussion (solution)

I didn’t think about it. At first glance
it feels like clear floating

Add float in css: left... ...Read more tutorials

What the poster said is so confusing. Normally, shouldn't DIV be like this? Otherwise there will be a problem. If you want DIV2 and DIV1 to be side by side and the same height, you have to set it with FLOAT: LEFT or FLOAT: RIGHT. If you don't set it, the line will be broken, even if DIV1 and DIV2 are only 1PX wide.

Do you want them to be parallel or parallel? If they are parallel, you can use the method mentioned above, use float

Haha, this is the most normal way.
If you want them to be side by side, just float

Add overflow: hidden to div1;

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn