您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

html怎么让div不换行

2024/5/23 7:52:33发布26次查看
html让div不换行的方法:1、使用displays属性,只需要给div标签添加“display: inline-block;”样式即可。2、使用float属性,只需要给div标签添加“float: left;”样式即可。
本教程操作环境:windows7系统、css3&&html5版、dell g3电脑。
div默认自动换行,但可以使用以下两种方式来控制不换行
1、使用displays属性
display: inline-block;

<!doctype html><html> <head> <meta charset="utf-8"> <style> div{ width: 300px; height: 300px; background-color: #20b2aa; display: inline-block; } </style> </head> <body> <div></div> <div></div> </body></html>
2、使用float属性
float: left;
例:
<!doctype html><html> <head> <meta charset="utf-8"> <style> div{ width: 300px; height: 300px; background-color: #00aa00; float: left; } </style> </head> <body> <div></div> <div></div> </body></html>
更多编程相关知识,请访问:编程视频!!
以上就是html怎么让div不换行的详细内容。
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product