In order to prevent content from wrapping around the floated element you could wrap the content including #media_type
, #categs
and #keywords
divisions by a wrapper <div>
and apply an overflow
property to that element as follows:
<div class="wrapper">
<div id="media_type"> ... </div>
<p>
<a href="some-url" target="_blank">Feed</a>
</p>
<div id="categs"> ... </div>
<div id="keywords"> ... </div>
</div>
.wrapper {
overflow-x: auto; /* or overflow-x: hidden; */
}
You could also use overflow
property instead of overflow-x
for better browser support.
As per your comment:
if the category list is large enough, I would like the
#keywords
list to slip below the image.
I should note that since you are floating all the list items, you should clear the float at the end of the <ul>
list element in order to make the parent to be as tall as its floated children.
This could be happen simply by using overflow
property for the parent elements:
#categs > ul,
#keywords > ul {
list-style: none;
overflow: hidden; /* This will create a new block formatting context */
/* https://developer.mozilla.org/en-US/docs/CSS/block_formatting_context */
}
This will push the #keywords
element to a new line.
You might also want to consider this great answer from @MrAlien: