7 replies [Last post]
greencode
greencode's picture
User offline. Last seen 48 weeks 5 days ago. Offline
newbie
Timezone: GMT+1
Joined: 2011-05-07
Posts: 5
Points: 7

I thought this would be straight forward at first but it's proving to be a tricky devil!

I'm wanting to have titles appear like this .......... Title ..........

But the dots (can be an image) would be centered vertically (i.e. not sit on the baseline as per my example above). My first attempt was to have the entire element as a h1 tag and than add a span tag for the title - then I could add a repeating image to the h1 tag and add a background colour to the span tag so that the dots didn't show up under the title. That works perfectly on solid colour backgrounds as I can specify that colour for the span background colour.

The problem with that is the background of the page varies and is often an image so the background colour of the span tag shows up.

Any help or ideas would be greatly appreciated as I've hit a brick wall with this one!

Vashin
Vashin's picture
User offline. Last seen 1 year 4 days ago. Offline
rank Regular
Regular
Timezone: GMT+10
Joined: 2011-05-07
Posts: 48
Points: 48

You could have an image of

You could have an image of the dots actually inserted next to the title rather than a background image.

Something like:

<img src="imagePath/imageName.jpg" alt="yourAltTag" /> Title <img src="imagePath/imageName.jpg" alt="yourAltTag" />

Then they will not go underneath the text. All you'll need to adjust is padding on the word 'Title' as it will be aligned to the bottom.

Please read the rules of CSSCreator before your next post. Following the rules and posting within the guidelines will enable members to assist you much more accurately than if you don't which not only saves us time, but gives you your answers faster.

Verschwindende
Verschwindende's picture
User offline. Last seen 14 weeks 6 days ago. Offline
rank Guru
Guru
Timezone: GMT-5
Joined: 2009-10-09
Posts: 2037
Points: 2256

Do you mean something like

Do you mean something like this: http://feelerdealer.com/dots/

If I'm on the right track I can explain further.

yet again.

greencode
greencode's picture
User offline. Last seen 48 weeks 5 days ago. Offline
newbie
Timezone: GMT+1
Joined: 2011-05-07
Posts: 5
Points: 7

Yes that's it. But I've just

Yes that's it. But I've just tried a more complex background and changed the typesize as well as line height and it then doesn't seem to work as well and the background of the span element is clearly visible?

Verschwindende
Verschwindende's picture
User offline. Last seen 14 weeks 6 days ago. Offline
rank Guru
Guru
Timezone: GMT-5
Joined: 2009-10-09
Posts: 2037
Points: 2256

greencode wrote: Yes that's

greencode wrote:

Yes that's it. But I've just tried a more complex background and changed the typesize as well as line height and it then doesn't seem to work as well and the background of the span element is clearly visible?

Notice the "fixed" on the background of the SPAN. It fixes it to the viewport allowing the background of the SPAN to move with the background of the BODY and since they are the same it looks seemless.

yet again.

greencode
greencode's picture
User offline. Last seen 48 weeks 5 days ago. Offline
newbie
Timezone: GMT+1
Joined: 2011-05-07
Posts: 5
Points: 7

I'm not too sure what I'm

I'm not too sure what I'm doing wrong then but if you take a look at this example you'll see that you can see the background behind the title:

http://bit.ly/laSSma

greencode
greencode's picture
User offline. Last seen 48 weeks 5 days ago. Offline
newbie
Timezone: GMT+1
Joined: 2011-05-07
Posts: 5
Points: 7

Anyone?

Could anyone help any further with this - from my example above you can see that it doesn't appear to work on complex backgrounds?

Verschwindende
Verschwindende's picture
User offline. Last seen 14 weeks 6 days ago. Offline
rank Guru
Guru
Timezone: GMT-5
Joined: 2009-10-09
Posts: 2037
Points: 2256

Add fixed to the containing

Add fixed to the containing DIVs background as well and see if that helps. Oh, and use a proper doctype.

yet again.