开发者

Need help/suggestions to set max-width of 1st line of h1 to avoid overlapping absolutely positioned element

Below is what my design looks like

Need help/suggestions to set max-width of 1st line of h1 to avoid overlapping absolutely positioned element

however with a long title, it looks like

Need help/suggestions to set max-width of 1st line of h1 to avoid overlapping absolutely positioned element

开发者_开发问答

How might I avoid the overlap? I created a fiddle to allow you to work on this (if you prefer)

http://jsfiddle.net/xhp7Q/


You can put the comment link first and float it to the right. That way the header will flow around it:

http://jsfiddle.net/xhp7Q/1/

.comments {
  float: right;
  height: 30px;
  font-size: 26px;
  font-weight: bold;
  border: 5px solid #eee;
  color: #000;
  color: red;
}


Just change position:absolute; to position:relative; in .comments and add float:right;

Then move this:

<a href="#" class="comments">10</a>

To the top of the p and h1 elements:

Demo

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜