[whatwg] <table> Relation between "bordercolor" and "border" attributes

Tab Atkins Jr. jackalmage at gmail.com
Tue Mar 6 08:35:39 PST 2012

On Tue, Mar 6, 2012 at 1:58 AM, Kishore Bolisetty <ganesh.bksv at gmail.com> wrote:
> Hi All,
> I have been looking at spec for finding relation between html table's
> bordercolor and border attributes.
> http://www.whatwg.org/specs/web-apps/current-work/
> When a table<http://www.whatwg.org/specs/web-apps/current-work/#the-table-element>element
> has a
> bordercolor attribute, its value is expected to be parsed using the rules
> for parsing a legacy color
> value<http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-a-legacy-color-value>,
> and if that does not return an error, the user agent is expected to treat
> the attribute as a presentational
> hint<http://www.whatwg.org/specs/web-apps/current-work/#presentational-hints>setting
> the element's 'border-top-color', 'border-right-color',
> 'border-bottom-color', and 'border-right-color' properties to the resulting
> color.
> ------------------------------
> The table<http://www.whatwg.org/specs/web-apps/current-work/#the-table-element>element's
> border<http://www.whatwg.org/specs/web-apps/current-work/#attr-table-border>attribute
> maps
> to the pixel length
> properties<http://www.whatwg.org/specs/web-apps/current-work/#maps-to-the-pixel-length-property>'border-top-width',
> 'border-right-width', 'border-bottom-width',
> 'border-left-width' on the element. If the attribute is present but parsing
> the attribute's value using the rules for parsing non-negative
> integers<http://www.whatwg.org/specs/web-apps/current-work/#rules-for-parsing-non-negative-integers>generates
> an error, a default value of 1px is expected to be used for that
> property instead.
> But it doesn't talks about the behaviour - what if border is not specified
> but bordercolor is specified? Looks like browsers have taken their own
> implementations on this, Opera and Mozilla displays bordercolor only if
> border is specified, where as Safari displays bordercolor assuming a
> default border.
> Which one is correct behaviour? Is it not necessary to explicitly state
> this in the spec?
> Example Markup :
> <table id="2" borderColor="#00FF00">
>            <tr>
>                <td >Some Text</td>
>            </tr>
> </table>

This behavior depends on the browser's default stylesheet, and whether
they default borders to "border-style: solid; border-color:
currentColor;" or "border-style: solid; border-width: 0px;".  Browsers
are allowed to do either.


More information about the whatwg mailing list