Note that there are some explanatory texts on larger screens.

plurals
  1. POCSS sprite - Moving background for navigation (hover, active, etc) + spaces between elements
    primarykey
    data
    text
    <p>I'm doing a navigation menu with CSS sprite where instead of uploading a lot of images, you merge them all together and can see hover, active effects by moving background position, i.e. <a href="http://www.threestyles.com/tutorials/coding-apples-navigation-bar-using-css-sprites/" rel="nofollow">http://www.threestyles.com/tutorials/coding-apples-navigation-bar-using-css-sprites/</a></p> <p><strong>The difference</strong> in my navigation is that I have <em>spaces</em> between the navigation elements and I can't find the way how to move the background that it would work nicely. </p> <p>Elements either popup too close to each other (i.e. no space left between the elements while hovering between them) or the background moves too little/much if I change the properties. </p> <p>(http://s17.postimage.org/ska9gj065/navprrrob.jpg)</p> <p>Here's my navigation and sizes: </p> <p>"Priser" button - width: 100px; <br/> Space between "Priser" and "Reservere" - 15px. <br/> "Reservere" - width: 120px;<br/> Space between "Reservere" and "Klub" - 14px. <br/> "Klub" - width: 100px;<br/></p> <p>Sorry for not putting all of it to the image. </p> <p><strong>Here's my HTML:</strong></p> <pre><code>&lt;div class="nav"&gt; &lt;ul id="nav"&gt; &lt;li id="list1"&gt;&lt;a href="#"&gt;&lt;span&gt;Priser&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;li id="list2"&gt;&lt;a href="#"&gt;&lt;span&gt;Reservere&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;li id="list3"&gt;&lt;a href="#"&gt;&lt;span&gt;Klub&lt;/span&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p><strong>And my CSS:</strong> </p> <pre><code>#nav span { display: none; } #nav li { list-style-type: none; float: left; } #nav a { height: 45px; display: block; } #list1 { width: 100px; } #list2 { width: 130px; } #list3 { width: 100px; } #list1 a:hover { background: url(images/nav.png) 0px -45px no-repeat; } #list2 a:hover { background: url(images/nav.png) -115px -45px no-repeat; } #list3 a:hover { background: url(images/nav.png) -260px -45px no-repeat; } </code></pre> <p>It may not be very easy to understand until you test it but I didn't have where to host it at this moment. </p> <h2>So, the questions:</h2> <ol> <li>Is it possible to use this CSS sprite when you have <em>unused</em> space between the elements? </li> <li>If it is, what should should be the parameters in this case? </li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload