html中div标签怎么用?

html中div标签怎么用?,第1张

div现在一般网页的布局都是使用的div+css来布局,div的话,就是通过。

<div>

<div><p></p></div>

</div>

div的嵌套使用来完成整个网页的布局,你可以将div理解成一个一个的块,然后在div块中写入P等等标签,然后再通过CSS来修饰就行了,如高度,宽度,背景。

<div style="background:#f90text-align:center">test</div>

<div style="background:#f60"><span>usemen:</span><input type="text" style="border:1px solid #cccwidth:200pxheight:20px" ></div>

<div style="background:#f60"><span>usemen:</span><input type="text" style="border:1px solid #cccwidth:200pxheight:20px" ></div>

实现两个DIV盒子并排,一行只显示两列DIV布局,使用width宽度+float浮动即可实现一行显示两列DIV布局。

<!DOCTYPE html> 

<html> 

<head> 

<meta http-equiv="Content-Type" content="text/html charset=utf-8" /> 

<title>两个DIV并排</title> 

<style> 

.div-a{ float:leftwidth:49%border:1px solid #F00} 

.div-b{ float:leftwidth:49%border:1px solid #000} 

</style> 

</head> 

<body> 

<div class="div-a">第一个DIV盒子</div> 

<div class="div-b">第二个DIV盒子</div> 

</body> 

</html>


欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/zaji/6165260.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-03-17
下一篇2023-03-17

发表评论

登录后才能评论

评论列表(0条)

    保存