p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 (http://p2p.wrox.com/forumdisplay.php?f=389)
-   -   Ch 8: <asp:image> inside <a> & ext.CSS (pg. 274) (http://p2p.wrox.com/showthread.php?t=69335)

epc July 11th, 2008 10:29 PM

Ch 8: <asp:image> inside <a> & ext.CSS (pg. 274)
 
How do you create a zero border linked image utilizing a user control, <asp:Image> control, and an external style sheet that can be viewed site wide?

Said another way...

I understand how the inline example works with the default zero border (style="border-width:0px;"), but how do I bypass the inline version with the external stylesheet based on the two themes discussed in the book?

I also wanted to mention that I am brand new to web programming and I have found this book to be an excellent teaching tool.

Imar July 12th, 2008 04:37 AM

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.


All times are GMT -4. The time now is 12:30 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.