TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

CSS3 Box Model behaviour

41 点作者 dkannan超过 11 年前

6 条评论

shimonamit超过 11 年前
Paul Irish also discusses this in his blog post from Feb. 2012:<p><a href="http://www.paulirish.com/2012/box-sizing-border-box-ftw/" rel="nofollow">http:&#x2F;&#x2F;www.paulirish.com&#x2F;2012&#x2F;box-sizing-border-box-ftw&#x2F;</a>
nailer超过 11 年前
Modded up, but I really hope most frontend folk on HN already know about border-box.<p>Short ver: float two 50% widths beside each other. Change padding as you like later and not have stuff break.<p>I have been doing this for a year now, it&#x27;s godlike especially for in-browser design.
评论 #6761495 未加载
评论 #6761912 未加载
wwweston超过 11 年前
What I&#x27;ve been trying to figure out for years is when&#x2F;why content-box would be a desirable state of affairs.<p>Most of the time, you know the border-box width (and probably the padding and border) want the browser to figure out the content-width, which is why the standard box model always seemed like a pain, because it makes you do that instead (assuming you&#x27;re using units where that&#x27;s even possible).<p>I&#x27;m trying to think of a situation where that&#x27;d be useful -- where it&#x27;d be helpful from a layout perspective to start with content-width -- so I could figure out what the w3 folks were thinking, but I&#x27;ve always had trouble with that. Has anybody figured this out?
评论 #6762008 未加载
评论 #6793688 未加载
criswell超过 11 年前
Legacy IE got few things right, this was one of them.
iLoch超过 11 年前
For those of you who don&#x27;t know, Bootstrap 3 uses border-box for everything by default. Anyone who has worked with front end design a bit has probably cringed many times at the thought of having to assign the full dimensions of the box you want to an outer div, then create an inner div with padding in order to achieve the same result that border-box solves. Didn&#x27;t IE also invent @font-face?
AustinG08超过 11 年前
Pretty surprised that this basic, well known style rule is front page. I guess it&#x27;s not as well known as I thought.