永发信息网

关于CSS居中的问题

答案:4  悬赏:80  手机版
解决时间 2021-04-27 01:10
  • 提问者网友:像風在裏
  • 2021-04-26 13:15


body, html{
margin:0px; padding:0px;
text-align:center;
background-color:#CCCCCC;
}

#div01{
position:relative;
width:900px;
height:auto;
text-align:left;
}
#div1{ position:relative;
margin:0 auto;
padding:5px 5px;
width:900px;
text-align:left;
background-color:#FFFFFF;

background-repeat:repeat-x;
height:50px;
border-width:1px;
border-color:#FF00FF;
border-style:solid;
color:#000066;
font-size:20px;
font-family:黑体;
font-weight:bold;
text-decoration:none;
}
#div2{ position:relative;
left:auto;
margin:0;
width:449px;
height:200px;
text-align:left;
float:left;
background-color:#6666CC;
border-color:#FF0000;
border-style:solid;
border-width:1px;
color:#FF6600;
font-family:华文行楷;
font-weight:bold;
font-size:30px;
text-decoration:none;
}
#div3{ posinton:relative;
left:auto;
margin:0;
width:449px;
height:200px;
border-width:1px;
border-color:#FF00FF;
border-style:solid;
background-color:#0099CC;
color:#3300CC;
font-size:30px;
font-style:inherit;
font-weight:bold;
font-family:宋体;
}
a:link{
text-decoration:none;
}
a:hover{
text-decoration:underline;
color:#FF0000;
}
a:activer{
text-decoration:none;
}
a:visited{
text-decoration:none;
color:#000000;
}
a:hover{
text-decoration:underline;
color:#FF0000;
}

请问这段代码为啥第#div3不跟在#div2的后面,而是直接换行了。

最佳答案
  • 五星知识达人网友:春色三分
  • 2021-04-26 13:57
div3里面也加个float:left;
全部回答
  • 1楼网友:傲气稳了全场
  • 2021-04-26 15:58

把HTML代码也贴出来,我帮你看看

  • 2楼网友:掌灯师
  • 2021-04-26 15:25

清除浮动试试 clear:both;

  • 3楼网友:野慌
  • 2021-04-26 14:27
在div2和3里都加上一个float:left试试
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯