刚开始学div+css现在有一个问题,请教大神

html-css019

刚开始学div+css现在有一个问题,请教大神,第1张

bg的宽度是多少?

够不够放下里面的三个 kong,listclass,list

给bg一个足够的宽度,试试

总之问题一定出在宽度上,ul默认有上下margin,左边padding,另外,检查你的几个块的宽度

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8" />

<title>demo</title>

<style type="text/css">

.box{width: 970pxmargin: 0 auto}

.top{width: 100%float: leftmargin-bottom: 10px}

.top div:first-child{height: 103pxwidth: 277pxbackground: redfloat: left}

.top div:last-child{width: 679pxfloat: right}

.top div:last-child span:first-child{width: 137pxheight: 49pxmargin-bottom: 8pxbackground: greenyellowfloat: right}

.top div:last-child span:last-child{width: 679pxheight: 46pxbackground: greenyellowfloat: left}

.content{width: 100%float: leftmargin-bottom: 10px}

.c_left{width: 310pxheight: 435pxbackground: orangefloat: left}

.c_right{width: 650pxfloat: right}

.c_right div:first-child{width: 450pxfloat: leftmargin-bottom: 10px}

.c_right div:first-child span:first-child{width: 450pxheight: 240pxmargin-bottom: 10pxbackground: bluefloat: left}

.c_right div:first-child span:nth-child(2){width: 450pxheight: 110pxmargin-bottom: 10pxbackground: bluefloat: left}

.c_right div:first-child span:last-child{width: 450pxheight: 30pxbackground: bluefloat: left}

.c_right div:nth-child(2){width: 190pxfloat: rightheight: 400pxbackground: palevioletred}

.c_right div:last-child{width: 100%float: leftheight: 25pxbackground: green}

.bottom{width: 100%float: leftheight: 35pxbackground: darkblue}

</style>

</head>

<body>

<div class="box">

<div class="top">

<div></div>

<div>

<span></span>

<span></span>

</div>

</div>

<div class="content">

<div class="c_left"></div>

<div class="c_right">

<div>

<span></span>

<span></span>

<span></span>

</div>

<div></div>

<div></div>

</div>

</div>

<div class="bottom"></div>

</div>

</body>

</html>