Jan 31, 2002 #1 rufc Programmer Nov 20, 2001 47 GB Is there a way to put a background colour under a block of text with css? I can use a table cell with bg color but would prefer not to if css would do the same thing
Is there a way to put a background colour under a block of text with css? I can use a table cell with bg color but would prefer not to if css would do the same thing
Jan 31, 2002 #2 cian Technical User Oct 11, 2001 1,383 How about using span or div to enclose the text, then use CSS to specify the bg color of the span/div. span.mytext { background: #ff0000 } or div.mytext { background: #00008d } or if your text is in a table td.mytext { background: #00cc00 } <div class="mytext">This is my text</div> etc <td class="mytext">Text É enzo@endamcg.com http://endamcg.com Upvote 0 Downvote
How about using span or div to enclose the text, then use CSS to specify the bg color of the span/div. span.mytext { background: #ff0000 } or div.mytext { background: #00008d } or if your text is in a table td.mytext { background: #00cc00 } <div class="mytext">This is my text</div> etc <td class="mytext">Text É enzo@endamcg.com http://endamcg.com
Jan 31, 2002 1 #3 Boomerang Programmer Mar 30, 2001 766 NL Hi rufc, Try this: <P style="background-color:green;"> 1st sentence<br> 2nd sentence<br> </P> or put the style in your style sheet: .textbg { background-color:green; } <P class="textbg "> 1st sentence<br> 2nd sentence<br> </P> Hope this helps, Erik <!-- My sport: Boomerang throwing !! This year I will participate at the World Championships in Germany. (http://www.boomerang2002.com)!! Many Happy Returns !! --> Upvote 0 Downvote
Hi rufc, Try this: <P style="background-color:green;"> 1st sentence<br> 2nd sentence<br> </P> or put the style in your style sheet: .textbg { background-color:green; } <P class="textbg "> 1st sentence<br> 2nd sentence<br> </P> Hope this helps, Erik <!-- My sport: Boomerang throwing !! This year I will participate at the World Championships in Germany. (http://www.boomerang2002.com)!! Many Happy Returns !! -->
Jan 31, 2002 Thread starter #4 rufc Programmer Nov 20, 2001 47 GB Thanks boomerang, that`s what I was looking for, it will only be in one place on the entire site so no need to clutter up my style sheet. Upvote 0 Downvote
Thanks boomerang, that`s what I was looking for, it will only be in one place on the entire site so no need to clutter up my style sheet.
Feb 1, 2002 Thread starter #5 rufc Programmer Nov 20, 2001 47 GB Can you help again with another prob I`m having with css?? I have an external stylesheet which has a style: A { text-decoration: none; color : #000000; } My question is, would this overwrite all other link styles i.e. A.bodywh:hover { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #000000} A.bodywh:active { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FFFFFF} A.bodywh:link { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FFFFFF} A.bodywh:visited { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FFFFFF} Im` asking because I have a style that I need to change to a different colour to the rest of the links in the site, but it isn`t working! Upvote 0 Downvote
Can you help again with another prob I`m having with css?? I have an external stylesheet which has a style: A { text-decoration: none; color : #000000; } My question is, would this overwrite all other link styles i.e. A.bodywh:hover { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #000000} A.bodywh:active { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FFFFFF} A.bodywh:link { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FFFFFF} A.bodywh:visited { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; color: #FFFFFF} Im` asking because I have a style that I need to change to a different colour to the rest of the links in the site, but it isn`t working!
Feb 1, 2002 Thread starter #6 rufc Programmer Nov 20, 2001 47 GB sorry, it`s the A:hover { text-decoration: underline; color : #31659C ; } that is overriding it and changing the link to blue, but I need it to change to white cos it`s on the blue background doh! Upvote 0 Downvote
sorry, it`s the A:hover { text-decoration: underline; color : #31659C ; } that is overriding it and changing the link to blue, but I need it to change to white cos it`s on the blue background doh!
Feb 3, 2002 #7 BobbaFet Programmer Feb 25, 2001 903 NL put this in the tag that should be overwritting: !IMPORTANT It increases the weight of the declaration. This is how you implement it: P{COLOR: BLUE !IMPORTANT;} for example. I hope this helps, BobbaFet Everyone has a right to my opinion. E-mail me at caswegkamp@hotmail.com http://cwcon.50megs.com/ "<beer brand> is like making love in a cano... it's <f-word + ing> close to water !!!" - Monty Python's Flying Circus, 1969/70 Upvote 0 Downvote
put this in the tag that should be overwritting: !IMPORTANT It increases the weight of the declaration. This is how you implement it: P{COLOR: BLUE !IMPORTANT;} for example. I hope this helps, BobbaFet Everyone has a right to my opinion. E-mail me at caswegkamp@hotmail.com http://cwcon.50megs.com/ "<beer brand> is like making love in a cano... it's <f-word + ing> close to water !!!" - Monty Python's Flying Circus, 1969/70
Feb 5, 2002 Thread starter #8 rufc Programmer Nov 20, 2001 47 GB Thanks guys, those things worked, just one last request ) I want to have two styles (margin and background) in one p tag, how do I seperate them to make them both work, here`s what I have but doesn`t work:- <p class="body" style="margin-left: 5" "background-color:FFCC33;"> Upvote 0 Downvote
Thanks guys, those things worked, just one last request ) I want to have two styles (margin and background) in one p tag, how do I seperate them to make them both work, here`s what I have but doesn`t work:- <p class="body" style="margin-left: 5" "background-color:FFCC33;">
Feb 5, 2002 #9 Boomerang Programmer Mar 30, 2001 766 NL just replace the " " in the middle with a ; <p class="body" style="margin-left:5; background-color:FFCC33;"> Erik <!-- My sport: Boomerang throwing !! This year I will participate at the World Championships in Germany. (http://www.boomerang2002.com)!! Many Happy Returns !! --> Upvote 0 Downvote
just replace the " " in the middle with a ; <p class="body" style="margin-left:5; background-color:FFCC33;"> Erik <!-- My sport: Boomerang throwing !! This year I will participate at the World Championships in Germany. (http://www.boomerang2002.com)!! Many Happy Returns !! -->