View Single Post
  #2 (permalink)  
Old July 12th, 2008, 04:37 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi epc,

Because the style for the image is defined in-line, it takes precedence over any other CSS that has been set, either with an embedded or an external style sheet.
You can, however, override with !important (doesn't mean "not important" as it would in C# or JavaScript, but means "is important"). You can apply it like this:
Code:
img
{
  border: 2px solid red !important;
}
This overrides the in-line style on an image:

<img src="Plough.jpg" style="border: 9px solid green; />

So even if the image has an in-line style for a green, thick border, the img selector overrides this and gives the image a thinner, red border.

For more info: http://webdesign.about.com/od/css/f/blcssfaqimportn.htm

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote