2016-07-31 1 views
1

위의 위의 숫자를아래에있는 공백을 제거하는 방법을 알아낼 수 없습니다.인라인 블록 요소 위아래 공간을 제거하는 방법은 무엇입니까?

p.s line-height 공간을 제거하지 않습니다.

다음은 모든 요소에 대한 CSS입니다.

nav ul li { 
font-size:16px; 
display:inline-block; 
padding:20px; 
border: 3px solid black; 
} 

이미지 : SS

JsFiddle

+0

이미지를 볼 수 없습니다. 이미지에 대한 링크를 게시 할 수 있습니까? – ankitjain11

+0

@ ankitjain11 완료. – Akshit

+0

@str이 작동하지 않습니다. 문제를 이해하려면 이미지를 참조하십시오. – Akshit

답변

1

ul는 기본적 marginpadding가있다, 그래서 그것을

body { 
 
    padding: 0; 
 
    margin: 0; 
 
    font-family: sans-serif; 
 
} 
 
header { 
 
    background: #00795f; 
 
    width: 100%; 
 
    padding: 40px 0; 
 
    /* 40px top and bottom, 0px left and right */ 
 
    color: white; 
 
    text-align: center; 
 
} 
 
nav { 
 
    background-color: #43a286; 
 
    color: white; 
 
    overflow: hidden; 
 
    padding: 0px; 
 
    text-align: center; 
 
    margin: 0; 
 
} 
 
ul { 
 
/* padding: 0; you may need only the margin */ 
 
    margin: 0 
 
} 
 
a { 
 
    text-decoration: none; 
 
    color: inherit; 
 
} 
 
nav ul li { 
 
    font-size: 16px; 
 
    display: inline-block; 
 
    padding: 20px; 
 
    border: 3px solid black; 
 
} 
 
ul li:hover { 
 
    background-color: #399077; 
 
} 
 
section { 
 
    line-height: 1.5em; 
 
    font-size: 1.5em; 
 
    padding: 40px; 
 
    width: 75%; 
 
    margin: 0 auto; 
 
}
<header> 
 
    <h1>Loving it more everyday</h1> 
 
    </header> 
 
    <nav> 
 
    <ul> 
 
     <li> <a href="#" target="_blank"> Home </a> 
 
     </li> 
 
     <li> <a href="#" target="_blank"> About </a> 
 
     </li> 
 
     <li> <a href="#" target="_blank"> Blog </a> 
 
     </li> 
 
     <li> <a href="#" target="_blank"> Shop </a> 
 
     </li> 
 
     <li> <a href="#" target="_blank"> Gallery </a> 
 
     </li> 
 
     <li> <a href="#" target="_blank"> Contact </a> 
 
     </li> 
 
    </ul> 
 
    </nav> 
 
    <section> 
 
    When you try your best, but you don't succeed. When you get what you want, but not what you need. When you feel so tired, but you can't sleep. Stuck in reverse. And the tears come streaming down your face. When you lose something you can't replace.When 
 
    you love someone, but it goes to waste. Could it be worse? Lights will guide you home. And ignite your bones. And I will try to fix you. And high up above or down below. When you're too in love to let it go. But if you never try you'll never know. 
 
    Just what you're worth. When you try your best, but you don't succeed. When you get what you want, but not what you need. When you feel so tired, but you can't sleep. Stuck in reverse. And the tears come streaming down your face. When you lose something 
 
    you can't replace.When you love someone, but it goes to waste. Could it be worse? Lights will guide you home. And ignite your bones. And I will try to fix you. And high up above or down below. When you're too in love to let it go. But if you never 
 
    try you'll never know. Just what you're worth 
 
    </section>

를 재설정
+0

고마워, 똑딱 똑딱, 나는 이것을 모르는 것에 대해 어리 석다. 나는 왜 사람들이 "떠 다니는"것을 언급하고 있는지, 그리고 그 모든 것이 다른 개념이라는 것을 알지 못합니다. – Akshit

+0

문제 없음';)' – dippas

+0

웹 개발 학습과 관련하여 뭔가 궁금한 점이 있으면 어떻게하면 되겠습니까? – Akshit

관련 문제