border:none; Is that wrong?

T

Tim W

Editing my css and want no border on a certain element so change what
was the shorthand border declaration to
border:none;
which seems to work.

But looking in my manual of css it seems to say I ought to have it
border-style: none;
But is that the same thing, the first option being the shorthand
declaration with all the values missing except border-style?

Or should it be just deleted, no declaration = no border

All three options seem to work. Does it matter which one I use?

Tim w
 
N

Neil Gould

Tim said:
Editing my css and want no border on a certain element so change what
was the shorthand border declaration to
border:none;
which seems to work.

But looking in my manual of css it seems to say I ought to have it
border-style: none;
But is that the same thing, the first option being the shorthand
declaration with all the values missing except border-style?

Or should it be just deleted, no declaration = no border

All three options seem to work. Does it matter which one I use?

Tim w
CSS2 specs border-style: none;, as the correct usage.
 
J

Jukka K. Korpela

Editing my css and want no border on a certain element so change what
was the shorthand border declaration to
border:none;
which seems to work.

No wonder. It's correct. You can also remove the border by not setting
border properties at all, provided that you don't have a CSS rule
somewhere that sets a border on the element. Theoretically, browser
default style sheets might have such a rule (I don't think any of them
has, except for images inside links), so setting border: none explicitly
could be seen as extra safe.
But looking in my manual of css it seems to say I ought to have it
border-style: none;

Does it, really?
But is that the same thing,

Not at all, though they have partly the same effect, and depending on
circumstances, the difference need not have a visible impact.
the first option being the shorthand
declaration with all the values missing except border-style?

It's a shorthand notation, yes, but the values are missing in one sense
only: the values are not written in the rule. The rule still sets all
border properties, namely to initial values, unless explicitly
specified. See
http://www.w3.org/TR/CSS2/box.html#border-shorthand-properties

Specifically, border: none is by definition equivalent to the following:

border-width: medium;
border-style: none;
border-color: currentColor;

where currentColor is to be replaced by the color of the content of the
element (its color property value).

For most practical purposes, border: none and border-style: none have
the same effect, as the width and color of a nonexistent border do no
matter. But in complicated situations, the difference may matter.
Consider this:

td { border: solid red; }
td.foo { border: none; }
td.bar { border-style: dashed; }

What happens to <td class="foo bar">? It gets a dashed border of the
color of the element content, black by default. The reason is that
border: none sets the border color, too. If you had used border-style:
none instead, then the border would be dashed red.
 
H

Hot-Text

Tim W said:
Editing my css and want no border on a certain element so change what
was the shorthand border declaration to
border:none;
which seems to work.

But looking in my manual of css it seems to say I ought to have it
border-style: none;
But is that the same thing, the first option being the shorthand
declaration with all the values missing except border-style?

Or should it be just deleted, no declaration = no border

All three options seem to work. Does it matter which one I use?

Tim w


table {
border-style: none;
border-bottom-style: none;
border-left-style: none;
border-right-style: none;
border-top-style: none;
}

table {
border-style: none;
border-bottom: none;
border-left: none;
border-right: none;
border-top: none;
}

my.table {
border-style: none;
border-bottom-style: none;
border-left-style: none;
border-right-style: none;
border-top-style: none;
}

your.table {
border-style: none;
border-bottom: none;
border-left: none;
border-right: none;
border-top: none;
}
 
T

Tim W

table {
border-style: none;
border-bottom-style: none; border-left-style: none; border-right-style:
none; border-top-style: none;
}

table {
border-style: none;
border-bottom: none; border-left: none; border-right: none; border-top:
none;
}

my.table {
border-style: none;
border-bottom-style: none; border-left-style: none; border-right-style:
none; border-top-style: none;
}

your.table {
border-style: none;
border-bottom: none; border-left: none; border-right: none; border-top:
none;
}
It is beautiful in its way in its plainess, its rythm and repetition.
Its refusal to make any statement of meaning or give any clue to its
inspiration makes it like a chant in a language not understood on which
we can't help but overlay the work of our own imagination, drawn out by
the effort of concentration on poem which is so reluctant to speak. Like
Meditation or like true religion:

"Written not with ink, but with the Spirit of the living God; not in
tables of stone, but in fleshy tables of the heart."

Tim W
 
H

Hot-Text

Tim W said:
It is beautiful in its way in its plainess, its rythm and repetition.
Its refusal to make any statement of meaning or give any clue to its
inspiration makes it like a chant in a language not understood on which
we can't help but overlay the work of our own imagination, drawn out by
the effort of concentration on poem which is so reluctant to speak. Like
Meditation or like true religion:

"Written not with ink, but with the Spirit of the living God; not in
tables of stone, but in fleshy tables of the heart."

Mr. Tim W
A True belief,
A Stone can be broking,
But the Heart will Heal...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top