I am trying to make a text bold that is outputted by php.
Tried <b>
, <strong>
and CSS but it didnt work.
My php:
function generateWeekNumbers() { //Generate a list with week numbers for dropdown
$weekCount = 53;
$currentWeek = getWeekNumber();
for($i=1;$i<$weekCount;$i++)
{
if ($i == $currentWeek) {
echo '<option><span class="week">Week '.$i.'</span></option>';
} else {
echo '<option>Week '.$i.'</option>';
}
}
}
My css on the actual page:
.week {
font-weight: bold;
}
Also tried:
echo '<option><b>Week '.$i.'</b></option>';
Hope someone can help.
To bold the text in HTML, use either the strong tag or the b (bold) tag. Browsers will bold the text inside both of these tags the same, but the strong tag indicates that the text is of particular importance or urgency. You can also bold text with the CSS font-weight property set to “bold.”
<b> - Bold text.
You can not style option tag by using pure CSS.
You should have a look at this library.
http://ivaynberg.github.io/select2/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With