gpt4 book ai didi

css - 调整 CSS 中重复出现的数字属性的值而不是覆盖它

转载 作者:行者123 更新时间:2023-11-28 12:27:06 24 4
gpt4 key购买 nike

考虑以下代码:

[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 实现吗?

最佳答案

CSS 不支持。

在您的特定示例中,您可以使用 padding-left 来添加额外的空间。

关于css - 调整 CSS 中重复出现的数字属性的值而不是覆盖它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18470203/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com