考慮下面的代碼:調整在CSS中reccuring數字財產的價值,而不是覆蓋它的
[example.htm]
<link rel="stylesheet" src="myStyle.css" />
<style>
div {margin-left: 100px} /* let's assume this margin value is dynamically generated in PHP/ASP/JSP and we dont't have control over it */
</style>
<body>
<div>foo</div>
<div class="indent-me-more-please">bar</div> <!-- let's assume we don't have control over this part, either -->
</body>
和
[myStyle.css]
.indent-me-more-please {margin-left: * !important}
是否有可能設定臨界值(標記爲*
)總是比僅在<style>
標籤中設置的值的值大50px或例如在元素屬性?在這種情況下:100px + 50px = 150px。像「margin-left += 50px;
」這樣的東西打電話,我不知道,相對增值?
是否有可能在純CSS中做到這一點?
您提到'margin-left + = 50px;',這可以與jQuery一起使用,並且會被認爲是正確的方法。 – Vector