These forums are currently read-only due to receiving more spam than actual discussion. Sorry.

It is currently Sat Dec 02, 2017 4:10 pm Advanced search

Block-level linking in ie7

Here you can discuss things related to HTML and the Web in general that do not fit in to other categories.

Block-level linking in ie7

Postby Newcoma » Fri Mar 25, 2011 11:42 am

Hello
I have the following html

<a>
<div>
<img src="myimage.gif" alt=" />
</div>
</a>

css
div {width:140px;}

In ie7 the <a> is not clickable if the img is wrapped in a div with a fixed width.

Any solution to this?
Newcoma
<h6>
 
Posts: 2
Joined: Fri Mar 25, 2011 11:33 am

Re: Block-level linking in ie7

Postby Xdega » Fri Mar 25, 2011 8:55 pm

Is it manadatory that the <a> be wrapped in a <div>? if not you can turn the <a> in to a block element using display: block; and get rid of the <div>

Here is what the code would look like?
html
Code: Select all
<a class=link>
<img src="myimage.gif" alt="myimage">
</a>


css
Code: Select all
.link {
display: block;
width:140px;
}
Xdega
<h2>
 
Posts: 124
Joined: Tue Mar 01, 2011 6:30 pm
Location: USA

Re: Block-level linking in ie7

Postby Newcoma » Fri Mar 25, 2011 10:02 pm

yes i Need the div. Im just wondering why it wont work with an img.
Newcoma
<h6>
 
Posts: 2
Joined: Fri Mar 25, 2011 11:33 am

Re: Block-level linking in ie7

Postby JAB Creations » Sat Mar 26, 2011 6:57 pm

Use the CSS display property to set an element to block or inline.

Code: Select all
img.example1 {display: block;}


If you want content to clear the left or right of the image use the CSS clear property.

Code: Select all
img.example1 {clear: both;}
img.example2 {clear: left;}
img.example3 {clear: right;}


You will most likely want to use the clear property.
User avatar
JAB Creations
<aside>
 
Posts: 566
Joined: Tue Mar 13, 2007 4:48 am
Location: Sarasota Florida, USA


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests