短暂须臾 3星
共回答了396个问题采纳率:99.1% 评论
要实现html文字浮动效果光靠HTML 是不够的还要加上CSS组合一起才行。
要用div float
float语法:
float : none | left |right
float 的基本属性
none:不进行浮动(默认)
left:浮动在其所在的块容器左侧
right:浮动在其所在的块容器右侧
html代码
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>div css 设定浮动</title>
<style>
/*设定div 的盒子大小*/
div
{
width:120px;
margin:0 0 25px 30px;
padding:15px;
border:1px solid black;
text-align:center;
}
/* 设定 盒子在右边浮动*/
.float-right {
float:right;
}
</style>
</head>
<body>
<div>1</div>
<div >盒子浮动在右边 2</div>
<div>3</div>
</body>
</html>
14小时前
猜你喜欢的问题
20天前1个回答
20天前1个回答
20天前1个回答
20天前1个回答
20天前1个回答
20天前1个回答
热门问题推荐
1个月前9个回答
1个月前1个回答
1个月前2个回答
4个月前2个回答
1个月前1个回答
3个月前2个回答
2个月前1个回答
1个月前3个回答
4个月前1个回答