View Full Version : Color Changing Border-Color
01-28-2012, 02:54 AM
I noticed that color: ; also changes the border-color. I've always thought it was a nuisance, but now I'm thinking about using it to my advantage.
I was wondering if color changes border-color for all browsers? and why?
01-28-2012, 11:19 AM
Here's an interesting blog post about it: http://www.impressivewebs.com/css-color-property/.
I can confirm that something like this works in IE6, IE9 Chrome and FF6:
<div style="border: solid 2px; color: red;">test</div>
01-28-2012, 12:25 PM
That's really weird because the "color" tag only changes the font color,
It is the "border" tag you need to change border colors.
01-28-2012, 02:24 PM
I have never known this, however, I always specify a colour in my border tag
01-28-2012, 09:36 PM
Kurios that is an absolutely excellent article. Where did you get the browser statistics? Is it possible this works in IE6, Chrome, FF3, S4, O10? If it doesn't then there isn't much use for it, seeing as the advantage is only minor.
01-28-2012, 11:24 PM
My gut feeling is that this is an actual CSS 2 specification, so all browsers probably follow this pattern. The browsers I listed were the ones I happen to be running, so I tried it in them.
If you want to try it, throw up a demo page and see what http://browsershots.org/ spits out. I haven't used that site in ages, but it looks like it still works.
01-29-2012, 01:38 AM
lol it's no coincidence browsershots abbreviation is "bs". Too slow for my taste, I'm going to use this anyways seeing that it is css2 and most likely supported in every browser even < ie5
01-29-2012, 10:50 AM
I was wondering if color changes border-color for all browsers? and why?This behavior is mandated by the CSS2.1 spec:
If an element's border color is not specified with a border property, user agents must use the value of the element's 'color' property as the computed value for the border color.
CSS3 Color defined this behavior more explicitly with a keyword:
CSS1 and CSS2 defined the initial value of the ‘border-color’ property to be "the value of the ‘color’ property" but did not define a corresponding keyword. This omission was recognized by SVG, and thus SVG 1.0 introduced the ‘currentColor’ value for the ‘fill’, ‘stroke’, ‘stop-color’, ‘flood-color’, and ‘lighting-color’ properties. CSS3 extends the color value to include the ‘currentColor’ keyword to allow its use with all properties that accept a <color> value.
Therefore, the default value for the border-color property is currentColor.
According to caniuse.com, CSS3 Color is supported in the latest release of every browser.
That's really weird because the "color" tag only changes the font color,In CSS, border is a property (not a "tag").
I have never known this, however, I always specify a colour in my border tagIn CSS, a property-value combination is a declaration (not a "tag").
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.