Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Im not understanding why Im having a margin below my image

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #180614
    mib70
    Participant

    Hi,

    Im having a margin below my image, and Im not understanding why.

    I have my example here:http: http://jsfiddle.net/kembwo4j/3/

    And as you can see I have a white space (margin) below my image, do you see why I have this space there?

    #180617
    Alen
    Participant

    Set the border-bottom: none; like so:

    
    .modal .img {
      width:200px;
      height:220px; 
      float:left;
      margin-right:10px;
      border:5px solid #f3f3f3;
      border-bottom:none;
    }
    
    #180618
    Alen
    Participant

    But I would pull it down little bit, like this:

    
    .modal .img {
      width:200px;
      height:220px; 
      float:left;
      margin: 10px 10px 5px 0px;
      border:5px solid #f3f3f3;
      border-bottom:none;
    }
    
    #180619
    mib70
    Participant

    Thanks for your answer Alen.

    But why I need to give a margin-top to my image to not have white space below it?

    Im really not understanding this!

    #180620
    Alen
    Participant

    The value is most likely inherited from the browser, meaning the browser decides what the margin should be if it’s not declared.

    http://webtypography.net/2.2.2

    #180621
    mib70
    Participant

    Ah ok Allen, thanks for the information and help.

    One last question, with your code solution, my text goes up and stays a bit above my picture. But if I set a margin-top for my pagraph text, I have again some white space below my image..lol!

    Do you see how I can fix this?

    #180623
    mib70
    Participant

    Thanks for your answer Soronbe! But I really dont want that white space below my image, you have other idea to fix this?

    #180624
    Alen
    Participant

    The issue is not with the margin, like Soronbe said text is really the issue.

    Look at the darker orange line it shows the actual margin.

    #180667
    Vincent_ZA
    Participant

    Granted there is no bottom margin – adding box-sizing: border-box to the img will solve this

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘CSS’ is closed to new topics and replies.