gpt4 book ai didi

html - 不影响容器的 float 图像

转载 作者:行者123 更新时间:2023-11-28 08:14:35 24 4
gpt4 key购买 nike

我需要在不影响 Div 容器的情况下将两个相似的图像 float 到部分容器的左侧和右侧。我需要它们在不影响红色框的位置或重叠的情况下占据绿色框的左侧和右侧。请帮忙。这是我的代码:

HTML:

<!Doctype html>
<html lang="eng">
<head>
<meta charset="utf-8">
<title>Envy</title>
<link rel="stylesheet" href="Envy.css">
</head>
<div id="M_wrap">
<body>

<div id="F_head">
<header id="M_head">Nhere</header>
<nav id="M_nav">
<ul>

<li class="Esec"><a href="#">New in stock</a></li>
<li><a href="http://www.w3schools.com/css/css_padding.asp">Men</a></li>
<li><a href="#">Women</a></li>
<li><a href="#">Children</a></li>
<li><a href="#">Accessories</a></li>
</ul>
</nav>
</div>
<section id="M_section">
<img class="SE1" src="Bg2.jpg">
<img class="SE2" src="Bg2.jpg">
<div id="S_wrap">

</div>
</section>


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

CSS:

body{

}
#M_wrap{
background-size:cover;
width:70em;
margin:.8em auto;

}

#F_head{
width:100%;
margin:.2em auto;
}

#M_head{
color:#000000;
font: Italic bold 80px/50px "Times New Roman" Arial, Tamoha;
text-align:center;
text-shadow:2px 2px #33ff00;
text-decoration:underline;

}
#M_nav{
height:3em;
width:37.5em ;
margin:2em auto;
background-color:black;
border-bottom: 1px solid #ccc;
border-top: 1px solid #ccc;
word-spacing:80px;
text-align:center;
font:Italic bold 30px/20px Times "Times New Roman", tamoha;
}
#M_nav ul li{
display:inline;
}

li.Esec{
word-spacing:0px !important;
}


#M_nav li a {
display:inline-block;
padding: 0px 15px;
font-weight:bold;
border-right: 1px solid #ccc;
}
#M_nav a:link{
color:white;
font:Italic bold 30px/40px Times "Times New Roman", tamoha;
text-decoration:none;
}

#M_nav a:hover {
color:white;
text-shadow: 2px 2px black;
text-decoration:underline;
color:#33ff00 !important;
}

#M_nav a:active{
color:red;
}


#M_nav a:visited{
color:white;
text-shadow:2px 2px black;
}

#M_section{
margin:-3.75em 0 0 0;
width:100%;
height:50em;
border-style:solid;
border-color:#33ff00;
}

#S_wrap{
margin:3em auto;
width:80%;
height:85%;
position:center;
border-style:solid;
border-color:red;


}

最佳答案

东西 like this

这是我更改的部分 CSS:

.SE1 {
float:left;
}
.SE2 {
float:right;
}

#S_wrap{
margin:0 auto 3em auto;
/* didn't touch rest of rules you have for this ID */
}

关于html - 不影响容器的 float 图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29062248/

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