CSS text background

  • futurebuzz
  • Student
  • Student
  • User avatar
  • Posts: 75
  • Loc: Birmingham England

Post 3+ Months Ago

Hello,

What i need is a CSS code that will change every second line of the texts background colour or text colour.

Like this:

testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestte
sttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestte
sttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestte
sttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestte
sttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest

Would i have to write it out for every single second line or is there a code that can do it all in one simple task?

I have an interview on my site but it gets very hard to follow after a while... switching lines etc.

Thanks for any help!
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1855
  • Loc: Uk

Post 3+ Months Ago

Someone correct me if I'm wrong, but I don't think you can state that altenate lines should be different colors.

The only way to do this would be to work out where all the lines end and start wrapping alternate lines in span tags:

Code: [ Select ]
this is line one which goes along to here
<span class="coloredline">and then this is line two which goes this far.</span>
Line three comes in after the colored bit......
  1. this is line one which goes along to here
  2. <span class="coloredline">and then this is line two which goes this far.</span>
  3. Line three comes in after the colored bit......


This will be an absolute pain in the ass if you change some text and it throws out all of the lines.....

In addition if someone is viewing on netscape (or similar) you cannot prevent them from changing the text size - which again throws out all of your hard work.

Hang on....
I have just reread your post, do you mean that stuff you say is in one color and then what the other person says is in another color?? Because that you can with the span tag.
  • futurebuzz
  • Student
  • Student
  • User avatar
  • Posts: 75
  • Loc: Birmingham England

Post 3+ Months Ago

Hey rtm223,

Cheers for the reply!

I have started to do that but as you know, the page i'm talking about as LOADS of text. http://www.futurecorps.net/00.htm

I could change the font colour, text, bg to make the second line stand out but that would mean alot of work. I do have 11 interview pages on my site.

One thing i have thought about doing is changing the colour using a mouse-over. It would act like a book marker, unless you nudge the mouse :x I think that would still require the span tag on each and every line :roll: Could it be done using the curser keys?

Any ideas? :idea:
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1855
  • Loc: Uk

Post 3+ Months Ago

hmmmmm.....

Maybe altering the font-size or line-height properties would make it more readable?

The mouse over might work but again you have to have the problem of doing it for every line.

The cursor keys is (i think) possible by writing a javascript, but its a bit of a pain, the same problem as above exists, plus you would have to have an introduction explaining to people how to do it!

I'm really not sure what to suggest to be honest. It is a difficult one...
  • futurebuzz
  • Student
  • Student
  • User avatar
  • Posts: 75
  • Loc: Birmingham England

Post 3+ Months Ago

Yes indeed, an difficult one :cry:

Another solution to the heavy reading problem would be to have a small preview of the interview, maybe a few lines... When the viewer clicks on the text, the rest of the interview scrolls out beneath the preview text.

I have searched for this kind of effect but failed to find anything.
  • rtm223
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 1855
  • Loc: Uk

Post 3+ Months Ago

haha I have a menu script for that (click on the category and subcategories scroll out), but it won't work for a text area lol.

Um webmonkey also have a expanding / colapsing menu thing, that you might be able to adapt to your needs, they also did a tutorial on it, which I cannot find now. I can't give you any links to plug and play scripts because I don't use them! Try some google searches for terms like
"javascript"
"expanding"
"collapsing"
"text area"

etc. See what you can find. I think that would be the best way, I also helps to make the page as a whole look less daunting!
  • futurebuzz
  • Student
  • Student
  • User avatar
  • Posts: 75
  • Loc: Birmingham England

Post 3+ Months Ago

Think i might have found something:

http://msdn.microsoft.com/workshop/samp ... isplay.htm

It's early days. I'll search for some more...
  • diverdan
  • Beginner
  • Beginner
  • diverdan
  • Posts: 46
  • Loc: Alabama, USA

Post 3+ Months Ago

why not do tables with different background colors?
or would that completely throw off the design of the page?
  • futurebuzz
  • Student
  • Student
  • User avatar
  • Posts: 75
  • Loc: Birmingham England

Post 3+ Months Ago

Slight updates to the page:

http://www.futurecorps.net/00.htm

Please let me know your thoughts...

No change on the alternate coloured text :x
  • diverdan
  • Beginner
  • Beginner
  • diverdan
  • Posts: 46
  • Loc: Alabama, USA

Post 3+ Months Ago

lookin' good, however, is there any way to add a 3-5 pixel border between the answers and the borders surrounding them? that may make the text a little easier to read
  • futurebuzz
  • Student
  • Student
  • User avatar
  • Posts: 75
  • Loc: Birmingham England

Post 3+ Months Ago

Good point. I have done what you sujested. Does look more readable! 8)

As for your other comment... The Table and Cells would still mean that i would have to write a span tag for every line and there's just too many of them! I did think of doing that though.

I don't think the page looks too bad now. One thing i need to fix is the cream colour on the left of the page. At the moment it's white.

Thanks for your comments, please keep them coming! I'm learning loads!! :D
  • diverdan
  • Beginner
  • Beginner
  • diverdan
  • Posts: 46
  • Loc: Alabama, USA

Post 3+ Months Ago

lots easier to read now

I don't see a white color, only cream so maybe you fixed that?

Post Information

  • Total Posts in this topic: 12 posts
  • Users browsing this forum: No registered users and 42 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.