Image size '%' not works with chrome & IE

Discussion in 'CSS' started by ceylongeek, Oct 26, 2010.

  1. #1
    I am currently creating a website and facing to a strange problem friends.I need your help to solve my issue.I have put a image on my website using below css code.It's working perfectly with firefox but not working with IE well and with chrome i can't even see the image.This problem comes when I set the size using '%' values like on my example for 'px' setting it's working very well.But for this situation it's important to place this as a percentage.

    .desc-img{
    width:60%;
    height:60%;
    margin-left:20px;
    }
    HTML:
    I have attached a screenshot of all main browsers with this message for your ease.

    Waiting for a help. :confused:
    Thank you
     

    Attached Files:

    • size.jpg
      size.jpg
      File size:
      17.8 KB
      Views:
      513
    ceylongeek, Oct 26, 2010 IP
  2. ethikz

    ethikz Peon

    Messages:
    92
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    hmm the coding looks ok...is the site live or local? if live could you post address?
     
    ethikz, Oct 26, 2010 IP
  3. AtomicPages

    AtomicPages Peon

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    This should work just fine. It's part of the CSS 2.1 Standard. You can view this standard here: http://www.w3.org/TR/CSS2/visudet.html#the-width-property
    Maybe have a defined width for the image and then use the css you have. You could add the height and width attributes in the image tag for this or use it in your external style sheet.
     
    AtomicPages, Oct 26, 2010 IP
  4. drhowarddrfine

    drhowarddrfine Peon

    Messages:
    5,428
    Likes Received:
    95
    Best Answers:
    7
    Trophy Points:
    0
    #4
    You set it to 60% but 60% of what? It's always the parent element so what width is the parent set to?
     
    drhowarddrfine, Oct 26, 2010 IP
  5. ceylongeek

    ceylongeek Peon

    Messages:
    26
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thank you everyone for your helps.I solved it, it was a problem of a <p> tag before <a href> tag.I removed that <p> tag now it's working well.


    Anyway thank you again for your quick responses
     
    ceylongeek, Oct 26, 2010 IP