Img Border Issue

Hi Guys,

Sorry for the stupid question but its being a while since I’ve coded. I cannot get the border property to work in the code below,

<img src=“” style=“padding:15px; border: 1px solid black;” height=“250” width=“250” alt=“good documentation is vital” align=“right” />

What am I doing wrong.

Thank you in advance.


That code should work fine. There must be something else going on there. What is not working?

Basically in this page Premier Validation LTD. » GAMP®5 an Evolution
the image is not displaying a border.

I just can’t figure it out!

You have this rule in line 41 of your style sheet:

a img {
  border: medium none !important;

It’s overriding the other rule. :slight_smile:

!important is a very dangerous declaration. I never use it. I would say remove it, and you should be fine.

Awesome great answer thanks so much,man

I am also new in this. so can you clear me, why this !important is a very dangerous in declaration?

Hi rogernelson! Welcome to SitePoint. :slight_smile:

!important is “dangerous” (OK, maybe too strong a word) because you can’t override it. On gokeeffe’s site, there is (or was) a rule declaring that an image can never have a border, anywhere on his site, under any circumstances. That’s the effect of the !important. It’s far too absolute a statement, as the issue above shows. If there are some images in some circumstances that should not have a border, it’s better to target them specifically—either by a special class, or even just with descendant selectors. E.g. if you want to make sure no images in a sidebar even have a border, use something like #sidebar img {border: none;}

ohh! thank ralph :slight_smile: Actually I am not facing this type of problem yet. That’s why i don’t about this…

It’s fine to ask questions. That’s what a forum is for. :slight_smile: I’ve learned a lot here that helped me when I came to similar situations, so yay for preemptive learning!