border="0"

A

AAaron123

On many examples I see the attribute:
border="0"

Why is that?

Is the default something else?

I don't do that and it seems OK but I don't check every browser type.

If I add it to my <body> or <html> will it apply to all enclosed tags?

Is it just certain tags that need it?



Thanks
 
N

Nathan Sokalski

There are a number of controls that have a property named Border. In most
cases it simple generates CSS for the control that sets the CSS border. But
in order to help you for any specific example, you will need to give us more
detail, such as what control you are referring to. Good luck!
 
G

Gregory A. Beamer

On many examples I see the attribute:
border="0"

Why is that?

Is the default something else?

I don't do that and it seems OK but I don't check every browser type.

If I add it to my <body> or <html> will it apply to all enclosed tags?

Is it just certain tags that need it?


I assume you mean table. The reason to explicitly set is some older
browsers (assume it is only older) used to set a border of 1 if nothing
was specified. By explicitly setting, you get rid of the border. I
believe cellpadding and cellspacing are also explicitly set, but I would
have to view source to be sure.
 
G

Göran Andersson

AAaron123 said:
On many examples I see the attribute:
border="0"

Why is that?

Is the default something else?

I don't do that and it seems OK but I don't check every browser type.

If I add it to my <body> or <html> will it apply to all enclosed tags?

Is it just certain tags that need it?

It is (or was) common on an image tag inside a link:

<a href="page.html">
<img src="images/what.gif" alt="What" border="0" />
</a>

The default for an image in a link is that it gets a border when you
hover over it with the mouse.

Nowadays css is often used instead (and recommended by development tools
and validation services). You can add this style in your style sheet to
fix this for all images that are inside links:

a img { border: none; }
 
A

AAaron123

Göran Andersson said:
It is (or was) common on an image tag inside a link:

<a href="page.html">
<img src="images/what.gif" alt="What" border="0" />
</a>

The default for an image in a link is that it gets a border when you
hover over it with the mouse.

Nowadays css is often used instead (and recommended by development
tools and validation services). You can add this style in your style
sheet to fix this for all images that are inside links:

a img { border: none; }

Is there a period (.) after the "a"

Thank you
 
A

AAaron123

Gregory said:
I assume you mean table. The reason to explicitly set is some older
browsers (assume it is only older) used to set a border of 1 if
nothing was specified. By explicitly setting, you get rid of the
border. I believe cellpadding and cellspacing are also explicitly
set, but I would have to view source to be sure.




*******************************************
*******************************************

How do you handle this?

Thanks
 
A

AAaron123

Mark said:
This was particularly true of the <img> tag which had a border of 1px
by default.

How do you handle this?
and do you do something only for the <img> tag or more than that?

Thanks
 
A

AAaron123

Göran Andersson said:
It is (or was) common on an image tag inside a link:

<a href="page.html">
<img src="images/what.gif" alt="What" border="0" />
</a>

The default for an image in a link is that it gets a border when you
hover over it with the mouse.

Nowadays css is often used instead (and recommended by development
tools and validation services). You can add this style in your style
sheet to fix this for all images that are inside links:

a img { border: none; }

Did that.
That's the only tag that needs fixing?


Thanks
 
A

AAaron123

Mark said:

I need to read some css again.
I forgot what two tags separated with space means.

Do you do it this way some times?
I know you sometimes do:
<img style="border:0px;" ......... />

It would be nice to do it once in a css file and have it apply globally.


thanks
 
A

AAaron123

So he does it if the <img> appears with an <a> tag.
You do it on all <img> tags.
would:
img { border: none; }
be a good way to go??

thanks
 
A

AAaron123

Mark said:
Only for the <img> tag.


I see where setting the width and not the style does more than meets the
eye.
The borderWidth property does not render if the borderStyle property is set
to none.

I decided not to do it in a css file.



Thanks
 
G

Gregory A. Beamer

How do you handle this?
and do you do something only for the <img> tag or more than that?


My personal opinion is always be explicit when you have any questions.
One might even shorten this to "always be explicit".

Explicit code is more maintainable, as it shows intent. It is also not
exposed to the whims of some browser developer out there in the cloud.

When I work with HTML, I will explicitly set the borders on tables,
images, etc.
 
G

Gregory A. Beamer

This was particularly true of the <img> tag which had a border of 1px by
default.

After I hit send, I realized the image tag was the important one, as most
"modern" browsers will default tables to zero. But the brain did not get in
gear before I hit the send button. ;-)
 
G

Gregory A. Beamer

<img style="border:0px;" ......... />



Actually, I like this one better:

..img
{
border: 0px;
}

as I almost never have images with borders. :)

I sure hope I wrote the descriptor correctly (have not been doing web
lately), as you will correct me if not. ;-)
 
A

AAaron123

Gregory said:
My personal opinion is always be explicit when you have any questions.
One might even shorten this to "always be explicit".

Explicit code is more maintainable, as it shows intent. It is also not
exposed to the whims of some browser developer out there in the cloud.

When I work with HTML, I will explicitly set the borders on tables,
images, etc.


*******************************************
*******************************************

Thanks
 
N

Nathan Sokalski

I just want to point out something about your CSS selector:

..img{border: 0px;}

Will create a CSS class named "img" that you would use by specifying the
class attribute in the html tag, such as:

<img class="img"/>

This is probably not what you wanted, and you definitely don't want to give
a CSS class the name "img". If you want to use a selector that will apply
the CSS properties to all img tags, do the following:

img{border: 0px;}

Notice that the difference is that there is no period before this, it is
simply the tag name. You may want to do a little reviewing of the general
syntax for CSS. Hopefully this helps.
 

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

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top