Why is there a gap between image and navigation bar

前端 未结 3 1012
离开以前
离开以前 2021-01-28 00:58

Hi I\'m having some trouble removing a small gap between an image and my navigation bar. I\'ve honestly tried just about everything i can think of. Setting inline-blocks on my u

3条回答
  •  一整个雨季
    2021-01-28 01:06

    Your gap is a white space like you find in between words since both element are set as inline boxes. In your CSS you set as well somme padding to ul and a , they both are there. http://jsfiddle.net/37VZb/8/

    .nav_bar, .nav{
        padding:0;
        display:inline-block;
    }
    

    To get rid of it:

    1) do not indent your code and get closing and opening brackets of element touch each other

    2) add a CSScomment in between to swallow that white-space

    3) set font-size to 0 (0.01px for IE) to parent of these inline-boxes and reset it ot back to 1rem (and or px/pt) for img (alt) and nav_bar

    negative margin or negative letter-spacing are not to be used, it is not reliable and not meant to care about this

提交回复
热议问题