Title This is dumy-6ren">
gpt4 book ai didi

html - 另一个 div 的 div 中的 margin 属性

转载 作者:行者123 更新时间:2023-11-28 18:23:25 25 4
gpt4 key购买 nike

html:

div id="wrapper">
<div id="itro">
<ul>
<li>
<h2> Title</h2>
<p>This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content. </p>
</il>
<ul>

<div id="logo"> <img src="image/bottom_logo.png" alt="logo" width="45" height="50" align="right">
</div>

</div>

CSS:

#wrapper
{
width:850px;
margin: 0 auto;
background: #B3B3B3;

}
#itro
{
width:550px;
border: 6px solid #000;
margin: 0 auto;
position: relative;
background:#E7E7E7;
margin-top:70px;
}

我想在#itro 上设置边距,但是当我在浏览器中看到它时,div id="wrapper"> 也设置了 top margin:70px;为什么?

最佳答案

CSS:

#wrapper{
width:850px;
margin: 0 auto;
background: #B3B3B3;
height:500px;
}
#itro
{
width:550px;
border: 6px solid #000;
margin: 0 auto;
position: relative;
background:#E7E7E7;
margin-top:70px;
float: left;
}

HTML:

<div id="wrapper">
<div id="itro">
<ul>
<li>
<h2> Title</h2>
<p>This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content.This is dumy content. </p>
</li>
</ul>
<div> <img src="image/bottom_logo.png" alt="logo" width="45" height="50" align="right" /></div>

</div>

</div>

有些标签打错了

关于html - 另一个 div 的 div 中的 margin 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16339252/

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