img选择器出错

时间:2013-09-10 02:37:52

标签: html css

这是我的HTML代码

<!DOCTYPE html>
<html>
<head>
    <title>Result</title>
    <link type="text/css" rel="stylesheet" href="stylesheet.css"/>
</head>
<body>
    <h1>testing css</h1>
    <p>this text shows the paragrpah going under css</p>
    <img src = "http://images.wikia.com/glee/images/1/1d/ImaFes.jpg" />
</body>
</html>

这是我的CSS代码

h1 {
    font-family: Verdana, sans-serif , serif;
    color:#576D94;
} 
p {
    font-size:18px;
    color: #4A4943;
    font-family: Garamond, serif;
}
img {
    height=100px;
    width=300px;
    border=1px solid #4682b4;
}

我发现的错误是img选择器。编辑器在img选择器行上显示一个空规则。 希望我没有对img选择器做任何错误。

抱歉,如果有任何语法错误

3 个答案:

答案 0 :(得分:0)

您应该使用冒号而不是等号:

img {
  height:100px;
  width:300px;
  border:1px solid #4682b4;
}

答案 1 :(得分:0)

你可以自己看看。

您正在使用:

img {
height=100px;
width=300px;
border=1px solid #4682b4;
}

应该是:

img {
height:100px;
width:300px;
border:1px solid #4682b4;
}

删除等号,它将如上所述。

答案 2 :(得分:0)

缺少冒号

img {
    height:100px;
    width:300px;
    border:1px solid #4682b4;
}

这是一个有效的 demo

相关问题