Home > Web Front-end > HTML Tutorial > 两个div同一行的问题_html/css_WEB-ITnose

两个div同一行的问题_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 09:27:30
Original
1084 people have browsed it

<div id=" test1" style="width:100px;display:inline;z-index:1;"><span class="yahei">ces:</span></div><div id="test2"style="display:inline;overflow:hidden;text-align:left;height:17px;width:80%;"><div id="test3" style="display:inline;height:10px;float:left;width:5000%">1111</div></div>
Copy after login

怎样让test1 和test2位于同一行??


回复讨论(解决方案)

display: inline改成float: left就可以了. 没必要改块级元素,如果变成行内元素你的宽高的设置也就没用了. 另外记得清除浮动,以免造成别的bug.

2个div都加上float:left 其他不要 再设置下就行了

Related labels:
div
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template