Quantcast
Channel: style image - no border - MODX Community Forums
Viewing all articles
Browse latest Browse all 16

Re: style image - no border

$
0
0
Hi,

From the code you posted above, it is normal that your image-links get a dotted border.
I assume you have this structure:

<div id="content">
(...)
<a href="..."><img src="..." /></a>
<a href="..."><img src="..." /></a>
(...)
</div>

So, the dotted border that you see is not attributed to the <img> tag, but to the link <a> tag. This explains why you see the dotted border, even if you put a style="border:none" in the <img /> tab.

To correct this, you must add a class to your links:
<div id="content"><a class="noborder"><img src="..."></a></div>


With
#content a.noborder, #content a.noborder img {border-style:none;text-decoration:none;}


If you want all your image-links being without border, also outside of your <div id="content">, you can omit the "#content" selector in code above.

An efficient technique when you have styling problem like the one you encountered is to give a margin around your inner block element:
<a href="..."><img src="..." style="margin:20px"></a>


Then, you can more easily find the problem and if necessary inspect elements with Firebug. In your case, you would see that the dotted border is attached to the "<a>" element and not to the "<img>" one.

The "<a><img></a>" sequence is not valid XHTML/HTML and you should rather use such code to build W3C valid image-links:
a.imagelink {display:block;background-repeat:none;text-decoration:none;background-position:top left}

<a href="..." href="target-document.html" target="_self" class="imagelink"
style="background-image:url(linked_picture.jpg)" > </a>

Viewing all articles
Browse latest Browse all 16

Latest Images

Trending Articles





Latest Images