微博输入框布局

原创 2018-11-08 11:23:55 286
摘要:<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title></title> </head> <style> body{font-size: 12px;} .box{height: 160px;width: 600px

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title></title>

</head>

<style>

body{font-size: 12px;}

.box{height: 160px;width: 600px;border: 5px solid pink;padding:10px}

.box img{float: left;}

.box div{height: 24px; width:150px;float: left;margin-left: 255px;text-align: right;color: #888;font-size: 14px;}

.box #number{font-weight: bold;font-size: 16px;}

.box #text{height: 100px;width: 600px;}

.box #sp1,#sp2,#sp3,#sp4,#sp5,#sp6{float:left;height:32px;width: 30px;line-height: 32px;padding-left: 26px;}

.box #sp5{width: 40px;}

.box #sp6{margin-left:150px;margin-right: 20px;}

.box #sp1{background: url(../img/an5.png) no-repeat left center;}

.box #sp2{background: url(../img/an4.png) no-repeat left center;}

.box #sp3{background: url(../img/an3.png) no-repeat left center;}

.box #sp4{background: url(../img/an2.png) no-repeat left center;}

.box #sp5{background: url(../img/an1.png) no-repeat left center;}

.box input{float: left;width: 80px;height: 30px;border: none;background: #FFC09F;border-radius: 5px;color: #FFFFFF;}

</style>

<body>

<div class="box">

<img src="../img/12.png" />

<div>还可以输入<span id="number">140</span>字</div>

<textarea id="text"></textarea>

<span id="sp1">表情</span>

<span id="sp2">图片</span>

<span id="sp3">视频</span>

<span id="sp4">话题</span>

<span id="sp5">长微博</span>

<span id="sp6">公开</span>

<input type="button" value="发布" />


</div>

</body>

</html>

  1. 输入框和外边框div的宽度一样,为了避免布局混乱,可在外边框设置内边距padding

  2. span标签是行内元素,span标签可通过设置浮动属性,就认为是一个块元素可以设置宽高,还有display = block

  3. 加入背景避免背景重复  no-repate  


发布手记

热门词条