Skip to content

Instantly share code, notes, and snippets.

@npero
Forked from asbarron/CSS
Created July 11, 2012 21:21
Show Gist options
  • Select an option

  • Save npero/3093608 to your computer and use it in GitHub Desktop.

Select an option

Save npero/3093608 to your computer and use it in GitHub Desktop.
Floating divs to auto shrink to text size
a:link { color:white }
img {
height:600px;
width:300px;
position: relative;
}
ul {
list-style-type: none;
padding:0;
}
#container {
top:30px;
padding:5px 0px 5px 0px;
position: absolute;
width:300px;
}
.item {
float:left;
background: rgba(0, 0, 0, 0.5);
height:25px;
margin: 5px;
padding:10px;
clear:both;
}
<img src="http://subtlepatterns.com/patterns/tileable_wood_texture.png" >
<div id="container">
<ul>
<li><a href="#"><div class="item">My</div><a></li>
<li><a href="#"><div class="item">supar long link hax</div><a></li>
<li><a href="#"><div class="item">brings all the</div><a></li>
<li><a href="#"><div class="item">divs inside the container.</div><a></li>
</ul>
</div>
http://jsfiddle.net/mztriz/xbvmf/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment