Home > Mobile >  How to make outer border of table to be of a colour different from inner in HTML without using CSS?
How to make outer border of table to be of a colour different from inner in HTML without using CSS?

Time:12-06

Table]1

I have to make this table in HTML. I don't understand how to make the outer border red while the others stay black. I can't use CSS and when I tried to use bordercolor="red" it changes the whole table border in red. I only want the outer border to be red. Any suggestions?

CodePudding user response:

You can add a style="" attribute to your <table>.

In the style="" attribute, you can add:

outline: 1px solid rgb(255, 0, 0)

Working Example:

<table border="1" style="outline: 3px solid rgb(255, 0, 0); width: 90px; height: 90px;">
<tr><td>1</td><td>2</td><td>3</td></tr>
<tr><td>4</td><td>5</td><td>6</td></tr>
<tr><td>7</td><td>8</td><td>9</td></tr>
</table>
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>


Second Approach (with no CSS at all):

<table bgcolor="#FF0000" width="90" height="90">
<tr><td>

<table border="1" bgcolor="#FFFFFF" width="88" height="88">
<tr><td>1</td><td>2</td><td>3</td></tr>
<tr><td>4</td><td>5</td><td>6</td></tr>
<tr><td>7</td><td>8</td><td>9</td></tr>
</table>

</td></tr>
</table>
<iframe name="sif2" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

CodePudding user response:

<table border="1" style="outline: 3px solid red">
<tr><td>1</td><td>2</td><td>3</td></tr>
<tr><td>4</td><td>5</td><td>6</td></tr>
</table>
<iframe name="sif3" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>

  •  Tags:  
  • html
  • Related