div探索系列(二):让多个div显示在一行(浮动的div)

div探索系列(二):让多个div显示在一行(浮动的div)一个 div 占据一行 怎样实现布局中 2 个并列的 div 呢 本节将解决这个问题 一 floate 属性可以使多个块状元素并列一行

大家好,欢迎来到IT知识分享网。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>无标题文档</title> <style type="text/css"> *{ 
    margin:0px; padding:0px; } #one { 
     width: 125px; background-color: #eee; height: 120px; border: 1px solid #000000; float:left; } #two { 
     width: 200px; background-color: #eee; height: 120px; border: 1px solid #000000; } </style> </head> <body> <div id="one">第一div</div> <div id="two">第二个div</div> </body> </html>

 

无标题文档

第一div
第二个div

免责声明:本站所有文章内容,图片,视频等均是来源于用户投稿和互联网及文摘转载整编而成,不代表本站观点,不承担相关法律责任。其著作权各归其原作者或其出版社所有。如发现本站有涉嫌抄袭侵权/违法违规的内容,侵犯到您的权益,请在线联系站长,一经查实,本站将立刻删除。 本文来自网络,若有侵权,请联系删除,如若转载,请注明出处:https://haidsoft.com/130325.html

(0)
上一篇 2025-08-16 09:10
下一篇 2025-08-16 09:15

相关推荐

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注微信