Html Can';是否不将内联样式移出到样式表?
我确信这是一个愚蠢的问题,但我不能将此内部(按钮)内联样式移动到样式表:Html Can';是否不将内联样式移出到样式表?,html,css,stylesheet,Html,Css,Stylesheet,我确信这是一个愚蠢的问题,但我不能将此内部(按钮)内联样式移动到样式表: <label style='white-space:nowrap; line-height:14px; height:14px; vertical-align:bottom; '> <input type = 'button' id = 'sButton2' style = 'cursor:pointer; width:30px; height:13px; float:
<label style='white-space:nowrap; line-height:14px; height:14px; vertical-align:bottom; '>
<input type = 'button'
id = 'sButton2'
style = 'cursor:pointer; width:30px; height:13px; float:left; margin-bottom:2px; margin-right:12px' >
The quick brown fox
</label>
愚蠢的问题,但是你确定样式表正在加载吗?我见过人们有多个样式表,但他们加载了错误的样式表,或者编辑了错误的样式表 稍后在样式表中还可能有一个覆盖样式。你有输入法吗?ID应该覆盖不太具体的样式,但在某些浏览器中存在一些您可能需要解决的bug 尝试使用!重要的 啊!是的,正如其他人所说,您的问题是css属性周围的单引号。
是ID的正确前缀(正如您在第二个代码示例中实际使用的那样),但您不应该在css代码周围加引号。试着这样做:
<style type="text/css">
#sButton2 { cursor:pointer; width:30px; height:13px; float:left; margin-bottom:2px; margin-right:12px; }
</style>
<input type="button" id="sButton2" />
#sButton2{光标:指针;宽度:30px;高度:13px;浮动:左侧;页边距底部:2px;页边距右侧:12px;}
执行代码(这总是一个好主意)也会告诉您所有这些 变化
#sButton { 'cursor:pointer; width:30px; height:13px; float:left; margin-bottom:2px; margin-right:12px' >
到
应该这样做
(删除开头和结尾的“,”并将>替换为})
遵循这样的标准是个好主意。您的内部样式以
而不是}
结尾
此外,它应该在您的头部
标签中
最后,你为什么要用单引号来包装你的风格?
<style type="text/css">
.sButton {
cursor:pointer;
width:30px;
height:13px;
float:left;
margin-bottom:2px;
margin-right:12px
</style>
<input type="button" id="sButton1" class="sButton">
布顿先生{
光标:指针;
宽度:30px;
高度:13px;
浮动:左;
边缘底部:2px;
右边距:12px
在Firebug(多么棒的一款软件)的大量帮助下,修复了此问题。输入标记位于jQueryUI对话框中,并从“对话框输入”继承了“宽度:95%”。我的样式表中的“宽度:30px”被忽略,直到我在所有F/F、Chromium和Opera中将其更改为“宽度:30px!重要”。它在两个div中都被忽略(#sButton 2)和类(.sButton)样式 我不明白这一点。如果你不能在不添加任意内容的情况下超越它,继承又有什么意义呢?重要的是?css继承被破坏了吗?不是吗?重要的是承认它被破坏了吗 我原本以为整个样式表都被忽略了,因为输入按钮扩展到了95%,使它看起来像其他所有东西都被忽略了一样。然而,我最终意识到,部分样式实际上起作用了—“cursor:pointer”确实显示了一个光标
谢谢大家。@ptriek谢谢你的提示,我刚刚删除了不正确的>似乎
在上执行验证程序对我来说仍然很神秘:-)单引号也让我感到不安。mh。似乎你最好发布一个在线示例的链接。(而且你最好快点,这里已经过了午夜)
#sButton { 'cursor:pointer; width:30px; height:13px; float:left; margin-bottom:2px; margin-right:12px' >
#sButton { cursor:pointer; width:30px; height:13px; float:left; margin-bottom:2px; margin-right:12px }
<style type="text/css">
#sButton2 { 'cursor:pointer; width:30px; height:13px; float:left; margin-bottom:2px; margin-right:12px' >
</style>
<style type="text/css">
#sButton2 { cursor:pointer; width:30px; height:13px; float:left; margin-bottom:2px; margin-right:12px }
</style>
<input type="button" id="sButton2" />
<style type="text/css">
.sButton {
cursor:pointer;
width:30px;
height:13px;
float:left;
margin-bottom:2px;
margin-right:12px
</style>
<input type="button" id="sButton1" class="sButton">