I'm struggling with the following horizontal menu:
http://jsfiddle.net/UeFeb/
I'd like each <li>
item in the menu to be separated by a backslash. I've based my menu on this method: https://stackoverflow.com/a/6880421/556006
How can I get the menu to:
- Have the slashes sit in the negative space between each
<li>
element so that they always sit in between each subsequent <li>
- When the browser width drops below 730px, automatically resize to 2 rows of 3
<li>
items (at the moment it drops one <li>
down at a time as the browser width is reduced)
Thoughts?
You can add the slashes automatically with CSS like so:
#menu li:after {
content: "\0020 \002F";
}
And as for the resizing you can sorta fake it using @media
queries for that. Take a look at this demo (readjust as necessary):
http://jsfiddle.net/andresilich/UeFeb/1/
Reworked my answer into a more satisfactory one, here is the breakdown for future users:
HTML
<ul id="menu" style="list-style:none">
<li><a href="#asics">ASICS</a></li>
<li>/</li>
<li><a href="#plants">PLANTS PLUS</a></li>
<li>/</li>
<li><a href="#tooheys">TOOHEYS</a></li>
<li>/</li>
<li><a href="#olympics">OLYMPICS</a></li>
<li>/</li>
<li><a href="#panadol">PANADOL</a></li>
<li>/</li>
<li><a href="#kia">KIA CADENZA</a></li>
</ul>
CSS
#menu {
height: 125px;
margin: 0 auto;
text-align: justify;
-ms-text-justify: distribute-all-lines;
text-justify: distribute-all-lines;
/* just for demo */
min-width: 90%;
}
#menu li {
max-width: 150px;
vertical-align: top;
display: inline-block;
*display: inline;
zoom: 1
}
#menu:after {
content: '';
width: 100%;
display: inline-block;
font-size: 0;
line-height: 0
}
@media screen and (max-width:730px) {
#menu {
min-width: 1px;
width: 35%;
}
}
http://jsfiddle.net/andresilich/UeFeb/3/