我有以下 html 文件:
<html>
<head>
<link rel="stylesheet" href="css/styles.css" type="text/css" media="all" />
</head>
<body>
<div>
<input type="text" />
<input type="email" />
<input class="button" id="clickme" type="submit" value="Click Me" />
</div>
</body>
</html>
head block 中有一个指向 css 文件的链接:
body {
background: gray
background-image: url(“../images/bg-body.jpg”);
}
input[type=”text”], input[type=”email”] {
border: none;
}
背景图像加载但两个输入仍然有一个可见的边框。在 IE 和 Chrome 中。但是,如果我指定内联样式,它就会起作用。
我正在使用 Notepad++ 编辑 html 和 css。这 ;不是错字,而是显示了另一个问题。如果我同时指定颜色和图像,在 IE 中会显示图像,但在 Chrome 中则不会。这里的工作有优先级吗?
最佳答案
像下面这样更新你的 CSS。将 ”
替换为 "
body {
background: gray;
background-image: url("../images/bg-body.jpg");
}
input[type="text"], input[type="email"] {
border: none;
}
编辑:
顺便说一下,它也可以在没有引号的情况下工作。
body {
background: gray;
background-image: url(../images/bg-body.jpg);
}
input[type=text], input[type=email] {
border: none;
}
关于CSS 样式不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24676675/