gpt4 book ai didi

html - 我怎样才能让我的侧边栏正确 float ?

转载 作者:太空宇宙 更新时间:2023-11-03 17:55:43 25 4
gpt4 key购买 nike

所以这让我发疯。在过去的两天里,我一直在努力让我的侧边栏向右浮动,但它一直出现在页面底部!答案可能很简单,但我似乎无法自己弄清楚...也许你们中的一个可以帮助我!

#wrap { 
width: 1200px;
/*margin: 0 auto;*/
background-color:#e6fdff;
color:#185358;
padding:0;
}
#content {
float:left;
clear:right;
padding:50px;
padding-bottom:80px;
/*margin:0 auto;*/
right:250px;
}
#sidebar {
float:right;
width:300px;
}
#sidebar ul {
list-style:none;
}
#sidebar ul a {
text-decoration:none;
font-family:'Crushed', cursive;
color:#4B3C27;
}
#footer {
width:100%;
height:60px;
position:fixed;
bottom:0;
left:0;
border:1px solid #4B323F;
border-width:1px 0;
background-color:#E6FDFF;
}
<div id="wrap">
<!--<div style="clear:both;"></div>-->
<div id="content">
<h2>Welcome to The Life of Esther!</h2>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.
</p>
<div id="sidebar">
<ul>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
</ul>
</div> <!--end sidebar div-->
</div> <!--end content div-->
<div id="footer"></div> <!--end footer div-->
</div> <!--end wrap div-->

最佳答案

首先需要从content div中取出sidebar,修改一些样式。请在此处查看更新代码 http://jsfiddle.net/w8gek7u8/

并查看下面的代码:

<style>
#wrap {
width: 1200px;
/*margin: 0 auto;*/
background-color:#e6fdff;
color:#185358;
padding:0;
}
#content {
float:left;
clear:right;
padding:50px;
padding-bottom:80px;
width:900px;
}
#sidebar {
float:right;
width:150px;
}
#sidebar ul {
list-style:none;
}
#sidebar ul a {
text-decoration:none;
font-family:'Crushed', cursive;
color:#4B3C27;
}
#footer {
width:100%;
height:60px;
position:fixed;
bottom:0;
left:0;
border:1px solid #4B323F;
border-width:1px 0;
background-color:#E6FDFF;
}
<style>

和 HTML 作为

<div id="wrap">
<!--<div style="clear:both;"></div>-->
<div id="content">
<h2>Welcome to The Life of Esther!</h2>
<p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.

Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi.

Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis.
</p>
</div> <!--end content div-->

<div id="sidebar">
<ul>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
<li><a href="blog1.html">Blog1</a></li>
</ul>
</div> <!--end sidebar div-->

<div id="footer"></div> <!--end footer div-->
</div> <!--end wrap div-->

关于html - 我怎样才能让我的侧边栏正确 float ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26383456/

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