Is there some way to keep a set width/height for a DIV, and pad the content without the DIV growing? See example below. I want all the boxes to be exactly 140x140.
H
The cleanest method would probably be to nest tags within your current tags, and apply the padding to them: Howdy. Howdy. Howdy. CSS: .div { /* ... */ } .div > div { padding: 1em; } /* Apply to all inner divs */ #box2 > div { padding: 1em; } /* Only apply to the inner div in #box2 */ 0 讨论(0) 查看其它5个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复
tags within your current tags, and apply the padding to them: Howdy. Howdy. Howdy. CSS: .div { /* ... */ } .div > div { padding: 1em; } /* Apply to all inner divs */ #box2 > div { padding: 1em; } /* Only apply to the inner div in #box2 */ 0 讨论(0) 查看其它5个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复
tags, and apply the padding to them: Howdy. Howdy. Howdy. CSS: .div { /* ... */ } .div > div { padding: 1em; } /* Apply to all inner divs */ #box2 > div { padding: 1em; } /* Only apply to the inner div in #box2 */ 0 讨论(0) 查看其它5个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复
Howdy. Howdy. Howdy.
CSS:
.div { /* ... */ } .div > div { padding: 1em; } /* Apply to all inner divs */ #box2 > div { padding: 1em; } /* Only apply to the inner div in #box2 */