html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link href="../css/base.css" rel='stylesheet' type='text/css' />
</head>
<body>
<div class="top_1">
用户名:<input type="text">
密码: <input type="password">
<a href="#">登录</a> <a href="#">注册</a>
</div>
<div style="clear:both"></div>
</body>
</html>
css
body {
margin:0;
padding: 0;
}
a {
text-decoration:none;
}
.top_1 {
height: 50px;
background: lightgreen;
float: right;
}
top_1不设置宽度(我是想要顶层宽度占满)虽然右边浮动,但是没有占满顶层。设置宽度100%后,他就不浮动了 请问怎么解决? 我希望顶层宽度100%,同事右边浮动
<!DOCTYPE html>
<html lang="en">
</html>