CSS 宽度 100% 超出界限

发布于 2024-12-13 21:06:53 字数 160 浏览 4 评论 0原文

看看这个;

http://jsfiddle.net/k2zyz/

为什么 100% 宽度的选项卡超出了容器?容器中的内容也具有 100% 宽度,这样效果很好吗?

Take a look at this;

http://jsfiddle.net/k2zyz/

Why is the 100% width tab exceeding the container? The content in the container also has a 100% width and this works just fine?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

梦中楼上月下 2024-12-20 21:06:54

因为内容区域的宽度是100%,那么就得加上margin、border、padding...

试试:

box-sizing: border-box;宽度:100%;

Because the width of the content area is 100%, then you have to add margin, border, padding...

Try:

box-sizing: border-box; width: 100%;

丑丑阿 2024-12-20 21:06:54

这是因为内边距 10px。

.dc-slick .slick-tab, .dc-slick .slick-tab-image { padding: 10px }

那些额外的 20px(左右各 10px)会导致溢出。如果你安装了 firebug 或类似的工具,这些事情就很容易弄清楚。

That's because of the padding 10px.

.dc-slick .slick-tab, .dc-slick .slick-tab-image { padding: 10px }

Those extra 20px ( 10px from left and right ) is causing the overflow. If you have firebug installed or a tool like that, such things can be easily figured out.

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