我需要将内部 CSS 中的“列”类 float 到中心,而外部 CSS 将其设置为左侧。
这是我的 CSS 文件:
body { text-align: center; font-family: Verdana, Geneva, Arial, Helvetica, sans-serif; }
#report { width: 1269px; margin: auto; float: left;
}
div.column{ margin-top: 10px; padding: 0px 0px; float: left; }
div.first{ padding-right: 8px; border-right: 1px grey solid; }
div.second{ margin-left: 8px;
}
...
这是我的带有内部 CSS 的 HTML:
<!DOCTYPE html>
<html>
<head>
<title>Dual Server Report</title>
<link rel="stylesheet" type="text/css" href="ServerReport.css">
<style type="text/css">
div.column{ float: center; }
</style>
</head>
<body>
<div id="report">
<h1>Automated PowerShell Install Report</h1>
<h2>This report was ran: 07/07/2015 09:03:21</h2>
<div class="column">
...
我检查了这三个类似的问题,但我试过的都没有用。
Internal Stylesheet NOT overriding External stylesheet?
“Inner” CSS Not Overriding “Outer” CSS
Overriding External CSS
编辑:
我记得昨天查找了“float”属性,但不记得找到了什么;在去仔细检查之前发布这个我觉得很愚蠢。 float 没有中心属性是有道理的。
我会保留它以防将来有人犯类似的错误。感谢所有回答的人,他们非常恭敬地指出了这个我应该自己发现的错误。
最佳答案
float: center
的属性值不存在。
float
属性有四个值:left
、right
、none
和 inherit
。
关于css - 内部 CSS 不会覆盖类的外部 CSS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31271518/