for th...">

Remove the link below the image only if the anchor tag contains img

<a href="#">
        <img width="103" height="100"  src="img source">
    </a>

for the above html code i use the following css

a {
    border-bottom-style: dotted;
    border-bottom-width: 1px;
}

a img {
    border: 0 none;
}

Basically, what I'm trying to achieve here is to underline text links by keeping img links without any underscores. however, I think when creating text links, I also put links to images, I want any image in the link not to be underlined.

Can anyone suggest working for this?

+5
source share
5 answers

The underlined text is called text decoration on a. So just apply text-decoration:noneto a.

: CSS " a, img ". CSS . , a , ( ) CSS , script, img a a .

+3

Googling , :

a img { border:none; vertical-align:top; }

?

: ; , . - z- .

:

, a < img... , , . : fooobar.com/questions/1931/...

+9

CSS Descendend Selector

, :

a > img { text-decoration: none; }

, ( ), , , , , . , CSS, .

0

, , javascript. - :

jQuery(document).ready(function($) {
    var a_with_img = $('a').children()
    $(a_with_img).parent().css('text-decoration', 'none');
});

, "a" js, . .

0

jquery jquery.js :

    <script type="text/javascript">

        $("body").ready(function () {

                $("a").has("img").addClass("imglink");

        });
</script>

a.imglink

0

All Articles