How to define the border color of a table without CSS?

Asked

Viewed 35,057 times

8

Is there any way? I don’t want CSS either external or internal, only pure html. Follow my code.

<table widths="30;60" cellpadding="1.5" border="1">
        <tr>
            <td>
                <p >Data:</p>
            </td>
            <td bgcolor="#dddddd">
                <p>@Model.DatFormulario</p>
            </td>
        </tr>
</table>

5 answers

8


So use bordercolor of the tag 'table':

 <table widths="30;60" cellpadding="1.5" border="1" bordercolor=red>
        <tr>
            <td>
                <p >Data:</p>
            </td>
            <td bgcolor="#dddddd">
                <p>@Model.DatFormulario</p>
            </td>
        </tr>
</table>
  • 1

    And to manipulate the edge of a tr or td? I couldn’t do it the same way the table does.

  • 1

    They made a change for me using bgcolor, thanks @Matheusbessa

  • Firefox has a color 3D border.

  • The only way I could find to take effect collapsed, is to use the background/cellspacing trick.

4

One of the ways (and that works consistently across all browsers) is to set the background of the table to a color, place a cellspacing, and then color the background of each white cell (or the color you want), so that the bottom of the table appears between the cells, and looks like an edge:

<table width="728" cellspacing="2" cellpadding="0" border="0" align="center" bgcolor="#ff6600">
    <tr bgcolor="#ffffff">
        <td width="240" height="67">&nbsp;</td>
        <td width="240">HTML table borders without CSS</td>
        <td width="240">&nbsp;</td>
    </tr>
    <tr bgcolor="#ffffff">
        <td height="67">cellspacing="2"</td>
        <td>&nbsp;</td>
        <td>bgcolor="#ff6600"</td>
    </tr>
</table>

jsfiddle

Reference:

HTML table Borders without CSS

3

You can use the attribute bordercolor

This is the color of the border (if you have the border turned on - that is if you use the border attribute in your TABLE tag).

That in free translation:

This is the border color (if you have the border on - that is, if you use the boundary attribute in your TABLE tag). In Netscape, this will only color the right background and border.

And you can even set the pattern for the light and dark colors of the edges using the attributes bordercolorlight and bordercolordark.

These attributes apply only to the outer edge of the table, there is no attribute to manipulate the edges of tr and td, in this case it will be necessary to .

2

Examples:

HTML attribute-ridden style for internal CSS use.

  <table widths="30;60" cellpadding="1.5" border="1" style="border-style:solid; border-color:#0000ff;">

HTML attribute-ridden bordercolor for color change.

  <table widths="30;60" cellpadding="1.5" border="1" bordercolor="#ff0">

bordercolor - use a hexadecimal color or English name (red, black, green, etc).

  • Well, maybe he didn’t want to use external CSS file, so using the style attribute is considerable. And also CSS can format a table very well.

  • 1

    @Eduardobrj Yes, that’s what I understood.

-1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.