分隔线的宽度 100% 减去几个像素

发布于 2024-11-01 02:38:04 字数 305 浏览 1 评论 0原文

下图将解释我的意思

单击此处查看图像

假装红色区域是不是分隔符,因为我只是希望它是空的,带有类似流体的分隔符,

position:absolute; left:0px; right:100px;

上面的东西不会起作用,因为我试图用已经使用位置的分隔符内的表格来执行此操作:绝对......它实际上是为了高度,但为了让解释更简单,我只要求宽度

the image below will explain what I mean

click here for image

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

药祭#氼 2024-11-08 02:38:04

你的具体问题相当令人困惑,但是,不,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.

┼── 2024-11-08 02:38:04

您可以使用 less css 框架(它处理 js),

您可以使用运算符,检查 Functions &在less官网中进行操作,非常有趣,你可以做这样的事情:

@base-color: #000000;
    #footer { 
      color: @base-color + #003300;     
}

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:

@base-color: #000000;
    #footer { 
      color: @base-color + #003300;     
}
你与昨日 2024-11-08 02:38:04

您可以使用 width: calc(100% -100px); 但不幸的是,并非所有浏览器都支持它。

You can use width: calc(100% -100px); but it's not supported by all browsers unfortunately.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文