分隔线的宽度 100% 减去几个像素
下图将解释我的意思
假装红色区域是不是分隔符,因为我只是希望它是空的,带有类似流体的分隔符,
position:absolute; left:0px; right:100px;
上面的东西不会起作用,因为我试图用已经使用位置的分隔符内的表格来执行此操作:绝对......它实际上是为了高度,但为了让解释更简单,我只要求宽度
the image below will explain what I mean
pretending that the red area is not a divider since I just want it to be empty with a fluid-like divider
position:absolute; left:0px; right:100px;
the above thing wont work because im trying to do this with a table inside a divider that is already using the position:absolute.... and it's actually for height but to make explaining simpler im just asking for the width
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你的具体问题相当令人困惑,但是,不,CSS 没有数学概念。例如,你不能做到 100% - 50px,尽管这确实很方便。
但是,您可以为元素指定特定尺寸的边距,如果您没有为元素指定定义的宽度,则默认情况下它是“自动”,因此将占用剩余空间。
所以左边的DIV可以设置100px的右边距。
如果它是关于 CSS 和流体布局的水平间距,这将回答你的问题。
至于您的垂直间距问题和表格,这实际上是完全不同的事情,因此建议您使用您正在寻求帮助的特定标记修改您的问题。
Your specific question is rather confusing, but, no, CSS has no concept of math. You can't do 100% - 50px, for instance, even though that would be really handy.
However, you can give elements margins of specific measurements, and if you don't give the element a defined width, it is, by default, 'auto' so will take up the remaining space.
So the left DIV could be set with a 100px right-margin.
That would answer your question if it were about CSS and horizontal spacing of a fluid layout.
As for your vertical spacing issues and a table, that's really an entirely different thing, so would suggest you revise your question with the specific markup you are looking for help on.
您可以使用 less css 框架(它处理 js),
您可以使用运算符,检查 Functions &在less官网中进行操作,非常有趣,你可以做这样的事情:
You could have a loot to less css framework (it deals with js)
you can use operators, check the Functions & Operations in less official website, very interesting, you can do things like:
您可以使用
width: calc(100% -100px);
但不幸的是,并非所有浏览器都支持它。You can use
width: calc(100% -100px);
but it's not supported by all browsers unfortunately.