views:

26

answers:

2

I couldn't think of any better way to name this question, but I'll explain.

I have a mediawiki website with a background pattern (like parchment) behind the articles. At the top of each article I want to have tabs like wikipedia does (with page | talk | edit etc links).

The problem is, the tabs should seamlessly fit with the article's background and I can't figure out if this is actually possible.

The way I was trying to do it was positioning the list inside the actual content div and give the <li> items a transparent background, but as far as I can see there's no way to color the rest of the <ul>'s background black without affecting the <li>'s in there.

Anyone have an idea?

+1  A: 

That's indeed not possible. I'd give the li elements a thick black border on left and right sides instead.

BalusC
that got me thinking, is there a possibility to make a last list item with a black background that just stretches to the end? (like would have been possible in a table, but then a little less outdated :P)
Litso
If `li` items are left-floating block elements, yes (right now they're just inline elements). Then you can give `li:last-child` a width of 100% and black background.
BalusC
if the solution below doesn't work I'll try that, thanks!
Litso
+1  A: 

You could have the <ul> outside of the content <div> and use a the background-position CSS property to position the background on the content <div> and move it up the height of the <ul>. Something like the following (note this is untested, just trying to give you a general idea):

<style>
  #links {
    background-image: url('/images/myawesomebackground.png');
    height: 20px;
  }

  #content {
    background-image: url('/images/myawesomebackground.png');
    background-position: 0px 20px;
  }
</style>

<ul id='links'>
  <li>Link 1</li>
  <li>Link 2</li>
</ul>

<div id='content'>
 Stuff goes here...
</div>
Topher Fangio
Damn, you're totally right. I've been breaking my head about a solution this way but I figured the backgrounds wouldn't fit seamlessly. I see now that they will. Thanks so much :)Will test and then accept this answer!
Litso
Glad to help :-)
Topher Fangio