![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hello, I am creating a search engine which searches keywords inside SQL database and displays the results in a web page. In the results web page I would like to give a grey background to the words which were used as Keywords for the search. How can I do this? |
#3
| |||
| |||
|
|
I am creating a search engine which searches keywords inside SQL database and displays the results in a web page. In the results web page I would like to give a grey background to the words which were used as Keywords for the search. How can I do this? |
#4
| |||
| |||
|
|
Hello, I am creating a search engine which searches keywords inside SQL database and displays the results in a web page. In the results web page I would like to give a grey background to the words which were used as Keywords for the search. l You can enclose the words in a span.: |
#5
| |||
| |||
|
|
In the results web page I would like to give a grey background to the words which were used as Keywords for the search. |
#6
| |||
| |||
|
|
Scripsit shapper: In the results web page I would like to give a grey background to the words which were used as Keywords for the search. Is this a trick question? At least the three answers you've got are essentially the same, and essentially wrong. So maybe it was a genuine question, though it looks _very_ elementary. Use <strong> markup for the words, optionally with a class attribute if you use <strong> for other emphasis as well, and something like strong { background: #ddd; color: black; font-weight: normal; padding: 0 0.1em; } The reason for font-weight: normal is that <strong> are typically displayed in bold by default and I assume you don't want that. It is essential to set color whenever you set background. The usefulness for padding becomes obvious if you try setting the background color without setting padding. |
#7
| |||
| |||
|
|
I think you owe your audience an explanation for declaring nearly identical solutions for "essentially wrong". |
|
It is especially important to explain if you want to achieve something with your statements... |
#8
| |||
| |||
|
|
I think you owe your audience an explanation for declaring nearly identical solutions for "essentially wrong". |
#9
| |||
| |||
|
|
Dag Sunde wrote: I think you owe your audience an explanation for declaring nearly identical solutions for "essentially wrong". No he doesn't! Jukka is infallible! Jukka is not to be questioned! Burn the heretics who disagree with The Word Of Jukka! Burn the unbelievers who even question The Word Of Jukka! |
|
As to his dogmatic assertion that <strong> should be used rather than span class="foo" >, then that's just pedantry stretched beyond the boundaries of rationality. HTML's semantics aren't sophisticated enough, let alone rigid enough, to require any absolute dogma like this. |
#10
| ||||
| ||||
|
|
A real net-nanny... |
|
I partly agree with him that a <strong> or <em> is semantically more correct than <span> in the case of OP's question. |
|
I just wanted him to put forth the rationale behind his thoughts, so the OP and potentially others could learn/understand. |
|
As to his dogmatic assertion that <strong> should be used rather than span class="foo" >, then that's just pedantry stretched beyond the boundaries of rationality. HTML's semantics aren't sophisticated enough, let alone rigid enough, to require any absolute dogma like this. Agreed! :-D |
![]() |
| Thread Tools | |
| Display Modes | |
| |