How can i get a background color to the text "Test" below? I have tried the following:
<table style="background-color:powderblue;" width="100%">
<tr>
<td><hr /></td>
<strong style="font-size: 35px;">Test</strong><br />
<td><hr /></td>
</tr>
</table>
but the results is:
Does exist any solution with HTML only? CSS doesn not work with the enviroment i use.
If this is actually supposed to be a table, this works:
<table width="100%"> <tr> <td> <hr /> </td> <strong style="font-size: 35px; background-color: powderblue;">Test</strong> <br /> <td> <hr /> </td> </tr> </table>
But I am baffled why you have a <strong>
tag with a font-size
of 35px
. You may as well use a <h1>
:
<table width="100%"> <tr> <td> <hr /> </td> <h1 style="background-color: powderblue;">Test</h1> <br /> <td> <hr /> </td> </tr> </table>
Replying to your comment, the <h1>
can be given a lightgray
background like this:
<table width="100%"> <tr> <td> <hr /> </td> <div style="background-color: lightgray"> <strong style="font-size: 35px; background-color: powderblue;">Test</strong> <br /> </div> <td> <hr /> </td> </tr> </table>
But usually, all children in a <table>
, including the <strong>
element, must be wrapped in a <td>
element (except for table headings, they should be wrapped in <th>
).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.