Jump to content

make a colored background area for a piece of text?


Guest sudoku

Recommended Posts

Guest sudoku

I've seen it before, but I can't find it anywhere in tutorials. I want to have a colored background area behind a piece of text. Can anyone help me? For instance, I want to have a black box or oval-type area with a red text on it in a sentence. Thanks, John

Link to comment
Share on other sites

:) try using a table, and make the table background in w,e colour u want it to be, then change the text colour to w.e suits u well thats how i wouldnt do it
Link to comment
Share on other sites

:) try using a table, and make the table background in w,e colour u want it to be, then change the text colour to w.e suits u well thats how i wouldnt do it
why a table? Just use a div with some height and width settings and put the text inside it. give the div a background color. orjust make a span element display as inline-block, give it height and width, and then pad the inside to get the text where you want it, or just use line-height if you just want to vertically center the text.
Link to comment
Share on other sites

why a table? Just use a div with some height and width settings and put the text inside it. give the div a background color. orjust make a span element display as inline-block, give it height and width, and then pad the inside to get the text where you want it, or just use line-height if you just want to vertically center the text.
I just fine that to be easier to do, cause you might not know if hes/she's good with the divs/span elements, so a table would come perfect for him/her to understanding or a easier way to do that :) sorry for the late reply end up being busy afta my last post
Link to comment
Share on other sites

I just fine that to be easier to do, cause you might not know if hes/she's good with the divs/span elements, so a table would come perfect for him/her to understanding or a easier way to do that :) sorry for the late reply end up being busy afta my last post
It's not good to educate new people with tables. That's the reason why people are still using them incorrectly today: they keep teaching others about it.
Link to comment
Share on other sites

It's not good to educate new people with tables. That's the reason why people are still using them incorrectly today: they keep teaching others about it.
most ppl understand tables easier then div,span,etc thats y i said " you might not know if hes/she's good with the divs/span elements, so a table would come perfect for him/her to understanding " :) he/she can use either div or span elements but if they don't understand what they are doing the table would come into play perfect for them
Link to comment
Share on other sites

Sorry, no. We do not advocate the use of bad practice just because it might be "easier." If someone is not good at writing correct HTML and CSS, they are free to ask questions. The seniors on this board, and a lot of others too, invest many hours a week happily answering those questions.If a problem gets hard, someone here will help it get solved the right way. Offering bad advice just makes everything harder for everyone.

Link to comment
Share on other sites

most ppl understand tables easier then div,span,etc thats y i said " you might not know if hes/she's good with the divs/span elements, so a table would come perfect for him/her to understanding " :) he/she can use either div or span elements but if they don't understand what they are doing the table would come into play perfect for them
sorry, I personally don't see how a table, with <tr> and <td> tags, would be less complicated than
<div id="divText">My Text</div>

with some very simple CSS. As everyone has mentioned, we advocate the use of best practices on this board, not hacks and shortcuts. If the user has heard all the options and still chooses to use a table, then all the more power to them, but we will still acknowledge the "error" of their ways.

Link to comment
Share on other sites

sorry, I personally don't see how a table, with <tr> and <td> tags, would be less complicated than
<div id="divText">My Text</div>

with some very simple CSS. As everyone has mentioned, we advocate the use of best practices on this board, not hacks and shortcuts. If the user has heard all the options and still chooses to use a table, then all the more power to them, but we will still acknowledge the "error" of their ways.

hey i rarely have problems with tables, n its not "bad advice" anyway later
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...