CSS: How the backgrounds can extend the border and overlap?

Posted by AlexStack on Stack Overflow See other posts from Stack Overflow or by AlexStack
Published on 2011-06-30T14:50:35Z Indexed on 2011/06/30 16:22 UTC
Read the original article Hit count: 185

Filed under:
|
|
|

I'm designing a navigation bar as shown in image below (a) with the following code:

<ul>
  <li class="unselected">Step 1</li>
  <li class="selected">Step 2</li>
  <li class="unselected">Step 3</li>
  <li class="unselected">Step 4</li>
  <li class="unselected">Step 5</li>
</ul>

The navigation bar

I want to have one background image for unselected steps (d) and one for the selected step (c). For simplicity let's assume Step 1 and Step 5 use the same background as well. I want to adjust the button background in HTML only with a class name.

The question is how can I achieve the result with CSS? I just want to know how background of two neighbor elements can overlap each other?

© Stack Overflow or respective owner

Related posts about html

Related posts about css