Setting Padding, Borders, and Margins for Images and Other Objects

The IMG and OBJECT elements are used to insert an inline image and other object into a Web page. Inline images are inline elements that are displayed at the position where they are inserted on a line. An object in HTML might be an inline image, a Java applet window, or a streaming video console, for instance.

In HTML 4 (and XHTML) the BORDER attribute, used to control the display of a border around an inline image or object, is deprecated, in favor of using styles to achieve the same or better results.

To see an example of specifying a border for an IMG element, first insert the following inline image toward the bottom of your example page:

 <div class="inset"> <ul> <li>Career ...

Get Cascading Style Sheets (CSS) by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.