Skip to: content, navigation

by Ian Lloyd

border (HTML attribute)

Spec
Depr. Version
Yes N/A
border="width in pixels or percentage"

Example

The border attribute on an image set to "20":

<embed src="giant-grasshopper.jpg" border="20"
height="206" width="300"></embed>

Description

By default, an embed will have no border around it. The border attribute rectifies this, and allows you to set a border specified in pixel width. Depending on the browser, the border will either be black or will match the color of the document’s text.

Figure 1. An embed element (a jpg image) with a border thickness of 20 pixels An embed element (a jpg image) with a border thickness of 20 pixels

Value

A number representing the width of the border in pixels.

Compatibility

This attribute is poorly supported and highly presentational. CSS should be used to control appearance instead.

Generally, browsers supported the border attribute for this element better when the type of content embedded was an image (Firefox correctly applied a border, as did Safari 2, while the newer Safari 3 did not apply a border; Opera did not apply as border to an image embed, nor did Internet Explorer. None of the browsers applied a border to the embed when the content of the embed was a Flash movie. In short - it’s a very hit and miss affair, mostly miss.

User-contributed notes

There are no comments yet.

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters