473,405 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

<img> tag within <a>: css behaviour and background

mickey0
142 100+
Hello,
I'm trying to put these images in line without any spaces surround. I wrote this piece of code and I'd like to understand why that code has that behaviour. Why the the <img> is not within the <a> element??
Any good links to this point will be very appreciated. Thanks.
http://www.2shared.com/photo/sMP1mE2I/followus.html

Expand|Select|Wrap|Line Numbers
  1. #followus {
  2.     clear: left;    
  3.     float: right;
  4.     width: 300px;
  5.     background: pink;
  6.     padding: 10px; margin:10px;
  7.     border: Dashed 2px;     
  8. }
  9. #followus img {    
  10.     border: Solid 2px;     
  11.     padding: 5px;
  12.     margin: 10px;
  13. }
  14.  
  15.  
  16. #followus img:hover {
  17.     border: Solid 2px yellow; 
  18. }
  19.  
  20. #followus a {
  21.         /* display:inline */
  22.     width: 70px;    
  23.     border: Solid 2px yellow;                 
  24. }
  25. #followus a:hover {        
  26.         background: black;        
  27. }
  28.  
Expand|Select|Wrap|Line Numbers
  1. <div id="followus">
  2.  <a....> <img ..... /> </a>
  3.  <a....> <img ..... /> </a>
  4. </div>    
  5.  
Nov 20 '11 #1
1 2060
zorgi
431 Expert 256MB
Anchor tag is inline element. Width or height don't work on inline elements. Try setting:

Expand|Select|Wrap|Line Numbers
  1. #followus a {
  2. .
  3. .
  4. .
  5. display: block;
  6. float: left;
  7. }
However I would probably remove all styling on anchor tag and just play with padding on images.
Nov 21 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: MyndPhlyp | last post by:
I've been busting my head trying to figure this out for quite some time. With IE6 and NS7, no problems. I can simply code the HTML <img height="100%"> and be done with it. But NS4 and NS6 (and...
12
by: Ted Mencini | last post by:
When I replaced older <IMG ALIGN=RIGHT ...> tags with a CSS definition <IMG class=right ...> xxx.css: IMG.right { BORDER: 0; align: right } I notice that the effect is NOT the same....
14
by: laurence | last post by:
I am implementing a comprehensive image-map generator utility, so have been studying W3C HTML 4.01 Specification (http://www.w3.org/TR/html4/struct/objects.html#h-13.6) on image maps (among other...
3
by: Henry Johnson | last post by:
Okay - I'm spinning my wheels on this one... can someone help me figure out how to programmatically populate a table cell as follows (from C# code-behind)? I've tried using a Literal control in the...
5
nathj
by: nathj | last post by:
Hi All, I'm working on a new site that has a two column layout underneath a title bar. If you check out: http://www.christianleadership.org.uk/scratch/mainpage.php using IE or Opera you will...
7
by: Christian Hackl | last post by:
Hi everyone, I've got a question about what makes the "img" element's width/height attributes valid HTML or XHTML. First of all, this is a rather theoretical question, but digging through the...
17
by: biju | last post by:
It is very common to see an image as a link on many web pages. Authors create them by putting an <imgtag inside a <atag. This is very much extra use of another tag. But why browsers dont support...
4
by: bgold12 | last post by:
Hey, I've come across a strange behaviour that shows itself in IE 7.0 and Firefox 3 and probably other browsers. In the code below, which is a complete HTML document which validates as XHTML 1.0...
17
by: Kaushal Elsner | last post by:
<contact_us_client_email> <message> &lt;!]&gt; </message> <header> <!]>From: support@blurbpoint.com </header> </contact_us_client_email>
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.