开发者

Auto-width for a Blogpost Title?

I want to make the title box auto-width, but I don't get it. Cannot post any 开发者_开发知识库Screenshots. My Css Code for the blogpost title is actually like this:

section#maincontent header{
position: relative;
left: 25px;
padding-left: 10px;
background: #e5e5e5;
margin-top: 50px;
padding-top: 0px;
padding-bottom: 0px;

-webkit-border-top-left-radius: 15px;
-webkit-border-top-right-radius: 15px;
-moz-border-radius-topleft: 15px;
-moz-border-radius-topright: 15px;
border-top-left-radius: 15px;
border-top-right-radius: 15px;
border: 1px solid #CCCCCC;
}

Need help! Thanks!


If you post your HTML code we'd probably be able to help you better, but in general a div is a block level element, so it will automatically expand to the width of its containing element. If you want the title to appear in a box that is as wide as the title itself (with a little padding) consider changing the div to display:inline, styling the title itself, or wrap it in an inline-element such as a span.

JSFiddle: http://jsfiddle.net/DHW7Y/7/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜