【发布时间】:2017-10-18 05:13:59
【问题描述】:
我有以下代码:
<!doctype html>
<html>
<head>
<title>Rich Home</title>
<meta charset="utf-8">
<style>
body { background-color: Black; color: White; }
h1 {text-align: center}
.st{ color: Green; background-color: Yellow; size: "80"; type:"text" }
</style>
</head>
<body>
<h1>Rich's Home Page</h1>
<form action="https://google.com/search" method="get">
Google: <input class=st name="q" autofocus>
<input type="submit" value="=>">
</form>
<form action="https://duckduckgo.com" method="get">
Duck: <input class=st name="q">
<input type="submit" value="=>">
</form>
</body>
</html>
我在 Firefox、Chrome 和 Chromium 中打开过。 color 和 background-color 应用于两个输入框,但 size 不是。这是为什么呢?
编辑以响应各种答案 cmets。改为使用以下行无效:
.st{ color: Green; background-color: Yellow; width: "600px"; type:"text" }
【问题讨论】:
-
您需要在值之后指定 px - 目前它正在达到
80并且就像“很棒 - 80 什么?”所以它什么都不做 -
@ThisGuyHasTwoThumbs 我尝试将大小更改为“400px”,但没有效果。
-
然后尝试使用宽度 - 在 css 中几乎不使用尺寸 - 更多的是 html 属性..
-
@RichOliver 将
"600px"更改为简单的600px(无引号)。 -
@HiddenHobbes 做到了。在发布带引号和不带引号的问题和大小之前,我尝试过宽度,但没有引号的宽度。
标签: css html-input