html - 带有 <ul> 的类不起作用

标签 html css

<分区>

我刚开始学习 html/css,发现有些东西令人困惑。

这是我的简单网页:

<html>
<head>
<meta charset="utf-8">
<link rel = "stylesheet" type="text/css" href="styles/css/style.css" />
</head>
<body>
<ul class:"menu">
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
</body>
</html>

这是我的 CSS 文件:

 li {
    list-style-type: none;
    margin-left: -35px;
   }  

.menu
{
    width:200px; 
    border: 1px solid #000; 
    font-family: 'Times New Roman';
    color: #880000;
    border-radius: 10px;
    box-shadow: 5px 5px #880000;
    background-color: #F9E497;
    font-size: 11.4pt;
    line-height: 1.5;
    margin-top: 5px; 
    margin-bottom: 5px;

}

我不明白为什么我的代码不接受 .menu 类。 当我在我的 css 文件中将 .menu 更改为 ul 时,一切都很好。 我错过了什么?

最佳答案

您正在使用 : 而不是 =

尝试:

<ul class="menu">

关于html - 带有 <ul> 的类不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36752818/

相关文章:

php - 面包屑 : change links depending on where I am

javascript - 刷新后如何选择相同的div

java - css v-verticallayout,如何设置高度

javascript - 通过 Javascript 的列高

html - 如何使用 CSS 居中 li 标签

css - 允许同时打开一个以上的 Accordion

Javascript Firefox - css 规则对象不返回样式表中的 id 选择器样式

javascript - DIV 中的长 UL 列表,自动滚动到 LI 元素

html - 为什么百分比高度不适用于我的 div?

css - 为 Internet Explorer 8 使列表项 float