Jiew Meng
Jiew Meng

Reputation: 88197

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

however with a long title, it looks like

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

http://jsfiddle.net/xhp7Q/

Upvotes: 0

Views: 95

Answers (2)

mylesagray
mylesagray

Reputation: 8869

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

Upvotes: 0

Guffa
Guffa

Reputation: 700252

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;
}

Upvotes: 1

Related Questions