gpt4 book ai didi

html - css 边距问题

转载 作者:太空宇宙 更新时间:2023-11-03 22:08:06 26 4
gpt4 key购买 nike

div“welove”在给定上边距时也会将包裹它的 div 向下推。我不希望这种情况发生。谁能告诉我我做错了什么?该网站在这里:http://littleboxcreative.com

--html--

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Little Box Creative</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" type="text/css" href="jqtransformplugin/jqtransform.css" />
<link rel="stylesheet" type="text/css" href="formValidator/validationEngine.jquery.css" />
<link rel="stylesheet" type="text/css" href="demo.css" />




<script type="text/javascript" src="js/jquery.jqtransform.js"></script>
<script type="text/javascript" src="js/jquery.validationEngine.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="script.js"></script>


</head>




<body>

<div id="wrapper">

<div id="header">

<div id="logo">
</div>
<div id="tagline">

<div class="tagline1">
</div>
<div id="headline">
</div>
<div class="tagline2">
</div>





</div>









</div>



<div id="body">
<div id="services">

</div>
<hr />
<div id="portfolio">

</div>
<div id="innerbody">
<div id="welove">

</div>
</div>
</div>
</div>
</body>
</html>

--CSS--

body {
background-color: #0E121B;
color: #ffffff;
}

#wrapper {
width:960px;
height: 100%;
margin:0 auto;
}

#header {
width: 960px;
height: 500px;
margin: 0 auto;
}

#logo {
width: 470px;
height:400px;
background-color: #ffffff;
float: left;
margin: 30px 5px 0 0;
}

#tagline {
width: 470px;
height: 400px;
float: left;
margin: 30px 0 0 0;

}

.tagline1 {
width: 379px;
height: 102px;
background-image: url('http://littleboxcreative.com/img/tagline1.png');
margin: 0 auto;
}

#headline {
border-top: 1px solid #080b10;
border-bottom: 1px solid #252e44;
height: 1px;
width: 370px;
margin: 40px 0 0 50px;
}

.tagline2 {
width: 407px;
height:96px;
background-image: url('http://littleboxcreative.com/img/tagline2.png');
margin: 50px 0 0 36px;
}

#services {
width:960px;
height: 500px;
background-image: url('http://littleboxcreative.com/img/niceback.jpg');
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
-moz-box-shadow: -5px -5px 15px #000;
-webkit-box-shadow: -5px -5px 15px #000;
box-shadow: -5px -5px 15px #000;

}

#portfolio {
width: 960px;
height: 500px;
background-image: url('http://littleboxcreative.com/img/paperback.png');
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
-moz-box-shadow: -5px -5px 15px #000;
-webkit-box-shadow: -5px -5px 15px #000;
box-shadow: -5px -5px 15px #000;


}

#innerbody {
width: 960px;
min-height:500px;
height: 100%;
background-image: url('http://littleboxcreative.com/img/backpattern.gif');
-webkit-border-radius: 0 0 10px 10px;
-moz-border-radius: 0 0 10px 10px;
border-radius: 0 0 10px 10px;
-moz-box-shadow: -5px -5px 15px #000;
-webkit-box-shadow: -5px -5px 15px #000;
box-shadow: -5px -5px 15px #000;

}

#welove {
width: 900px;
height: 200px;
margin: 45px 0 0 30px;
background-color: #000000;
opacity: 0.6;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;

}

最佳答案

我建议改为为容器 div 设置 padding-top:

#innerbody {
padding-top: 45px;
}

因为 overflow:hidden 可能会给 future 的设计选择带来问题。

关于html - css 边距问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3847697/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com