- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
CSS 新手。尝试使用列表创建水平和垂直菜单。我在水平菜单下的垂直列表转到下一行,但它从水平菜单结束的地方开始,就像缩进选项卡一样。如何让垂直菜单移到最左边?
CSS 和 HTML 代码:
ul {
margin-top: 0px;
margin-right: 0px;
margin-bottom: 1.2em;
margin-left: 20px;
list-style-type: none;
}
li {
background-image: url(../images/listimage.jpg);
background-repeat: no-repeat;
background-position: 0% 50%;
margin: 0px;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 16px;
}
.clearfloat {clear:both;
height:0;
font-size: 1px;
line-height: 0px;
}
#horizontal_M {
color: #FFFFFF;
background-color: #272910;
background-image: url(../images/btn.jpg);
background-repeat: repeat-x;
background-position: bottom;
border-top-width: 1px;
border-top-style: solid;
border-top-color: #FFFFFF;
width: 100%;
height: 31px;
}
#vertical_M {
background-color: #EEF0E3;
background-image: url(../images/sidemenubg.jpg);
background-repeat: repeat-x;
background-position: bottom;
margin-top: 0px;
margin-right: 15px;
margin-bottom: 0px;
margin-left: 15px;
padding-top: 20px;
padding-right: 0px;
padding-bottom: 14px;
padding-left: 0px;
float: left;
width: 200px;
}
<div id="horizontal_M">
<ul>
<br class="clearfloat" />
<li><a href="index.html">link 1/a></li>
<li><a href="index.html">link 2</a></li>
<li><a href="index.html">link 3</a></li>
<li><a href="index.html">link 4</a></li>
</ul>
</div>
<div id="vertical_M">
<ul>
<li><a href="index.html">link 1</a></li>
<li><a href="index.html">link 2</a></li>
<li><a href="index.html">link 3</a></li>
<li><a href="index.html">link 4</a></li>
</ul>
</div>
最佳答案
您不需要容器 div。可以设置样式<ul>
相反。
水平<li>
应该是 float: left;
垂直<ul>
设置 clear:left;
关于css - 不能将垂直菜单列表移到最左边,它在水平菜单列表下面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4401001/
我正在开发一个需要在屏幕上查找对象的程序,到目前为止工作正常,但我遇到了多显示器配置问题。 GraphicsEnvironment.getLocalGraphicsEnvironment().getS
使用 mySql,我想列出客户对特定产品类别进行的所有购买。 所以,我有 3 个表:客户 (idCustomer, Name)、类别 (idCategory, CategoryName) 和订单 (i
我的网站上有一个关于 background-size:cover 的小问题我一直在 Firefox 中测试它,但是当我在谷歌浏览器中加载页面时,我在左边得到 1px 的白色。当我使用 backgrou
我已经搜索了几个小时来找到解决我的问题的方法,但没有成功。我遇到的问题是两个按钮的垂直堆叠。 这就是我想要做的:它说按钮在这里两次是我试图放置按钮的地方,但我所能做的就是让它们水平排列而不是垂直排列。
我有一个包含多个元素的导航栏。 Left1 Left2 Left3 Right1 Right2 Right3 我不知道如何将“fixedLef
您好,我正在尝试让 2 个 div 在左侧与右侧对齐。 #div1 #div2 #div1 #div2 #div3 #div2 #div3 #div3 诀窍是当浏览器窗口变小时,我希望#div2 位于
body { font-family: Arial, Helvetica, sans-serif; font-size: 13px;
这个问题在这里已经有了答案: In CSS Flexbox, why are there no "justify-items" and "justify-self" properties? (6
这是我的代码的 jsfiddle 链接: https://jsfiddle.net/Krisalay/zvxxeagh/ 我的 HTML 代码是: MESSAGE 1
所以我有 10 个复选框,每个标签都取自数组中相应的索引。我正在使用 ng-repeat 来展示它们: {{entity}}
我是一名优秀的程序员,十分优秀!