gpt4 book ai didi

HTML 行为与 float 左侧菜单内联

转载 作者:太空宇宙 更新时间:2023-11-04 01:23:42 25 4
gpt4 key购买 nike

我有一个由无序列表组成的简单菜单系统。在这个菜单下面我想正常显示内容。然而,无论我使用多少 DIV,我想要显示的内容都会随着菜单项一起流动,如下所示:

enter image description here

我的 HTML 看起来像这样:

<div>
<div id="tabs">
<div>
<ul>
<li>Menu 1</li>
<li>Menu 2</li>
<li>Menu 3</li>
<li>Menu 4</li>
</ul>
</div>
</div>
<div>

<div>
<pre><span style="font-size: 11px">
asdf asfd asfd asdf asdf
asdf asdf asdf asdf asdf
asdf asdf asdf asdf asdf
asdf asdf asfd asdf asdf
asfd asdf asfd

</span></pre>
</div>
</div>

</div>

我是这样设计的:

#tabs ul {
list-style: none;
padding: 0;
margin: 0;
cursor: pointer;
}
#tabs li {
float: left;
border: 1px solid #000;
border-bottom-width: 0;
margin: 3px 3px 0px 3px;
padding: 5px 5px 0px 5px;
background-color: #CCC;
color: #696969;
}

fiddle :

https://jsfiddle.net/b8udxhdh/

如何防止我的内容代码以内联方式运行?

最佳答案

CSS clear property应该修复它。

我设法用

修复了你的 fiddle
#mainView { clear: both; }

关于HTML 行为与 float 左侧菜单内联,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48512887/

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