2014-04-13 3 views
0

기사 태그에있는 h2와 p 요소 사이의 빈 줄을 제거하고 싶습니다. (기사를 사용하는 이유는 무엇입니까? 내 강사가 프로젝트에서 5 개의 새로운 html5 요소를 사용하도록 요청했습니다.) 나는 시도했다 :h2와 단락 사이의 공백을 제거하는 방법

#prime h2 { 
    margin-top:0em; 
} 

#prime p { 
     margin-bottom:0em; 
} 

이것은 오른쪽과 2 개의 줄로 나의 h2를 줄곧 움직였다. .

#prime h2,p{ 
     padding: 0; 
     margin: 0; 
    } 

    #prime h2,p { 
     display: inline; 
    } 

이 캐롤에 의해 당사자에 오신 것을 환영합니다 H2와 같은 줄에 내 탐색 모음을 이동 : Josmh가 19시 16분에서 '11 10월 13일 대답에서 은 그럼 스택/오버 플로우 제안을 시도했다.

기사를 사용 중이므로 코드가 작동하지 않습니까? 내 코드 :

<!doctype html> 
<html> 
<head> 
<meta charset="UTF-8"> 
<title>Parties by Carol</title> 
<script src="SpryAssets/SpryMenuBar.js" type="text/javascript"></script> 
<link href="SpryAssets/SpryMenuBarHorizontal.css" rel="stylesheet" type="text/css"> 
<link href="css/main.css" rel="stylesheet" type="text/css"> 
</head> 

<body> 
<div id="wrapper"> 
    <header id="hdr"> 
    <h3>throw a ball</h3> 
    <h2>throw a line</h2> 
    <h1>Throw a Party!</h1> 
    <div id="party"><img src="images/balloons2.jpg" width="125" height="125" alt="A Party"/></div> 
    <p>Parties by Carol</p> 
    <ul id="MenuBar1" class="MenuBarHorizontal"> 
     <li><a href="Final-1.html">Home</a></li> 
     <li><a href="#">About Us</a></li> 
     <li><a class="MenuBarItemSubmenu" href="#">Types of  Parties</a> 
     <ul> 
      <li><a href="#">Quinceneras/Sweet 16</a></li> 
      <li><a href="#">Bar/Bat Mitzvahs</a></li> 
      <li><a href="#">Tots and Toddlers</a></li> 
     </ul> 
     </li> 
     <li><a href="#">Contact Us</a></li> 
    </ul> 
    </header> 
    <article id="prime"><h2>Welcome to Parties by Carol</h2> 
    <p> 
     For your next celebration, contact Parties by Carol. Whether your event is for two or two hundred, Parties by Carol can and will accommodate your needs. We specialize in fulfilling your every wish, whether at our facility or a location of your choice. We have a wide and varied menu that can be customized for your special event. Parties by Carol offers a combination of skills to help create unique and memorable occasions for you and your guests. So relax and leave everything to Parties by Carol. We aim to please and we will.</p> 
    </article> 
    <aside id="sbar1"> 
    <p>Beautiful Venue</p> 
    <p>Devine Food</p> 
    <p>Great Music</p> 
    <p>Fun People</p> 
    <p>&nbsp;</p> 
    </aside> 
    <footer>&copy;Copyright - 2014 CAS</footer> 
</div> 
<script type="text/javascript"> 
var MenuBar1 = new Spry.Widget.MenuBar("MenuBar1", {imgDown:"SpryAssets/SpryMenuBarDownHover.gif", imgRight:"SpryAssets/SpryMenuBarRightHover.gif"}); 
</script> 
</body> 
</html> 



#prime h2 { 
    margin-top:0; 
} 

#prime p { 
     margin-bottom:0; 
} 

#prime h2, p { 
    display: inline; 
} 

답변

0

여백을 다른 방식으로 설정하면 안됩니까? 나는 <p><h2> 아래라고 추측하고 있습니다.

h2 { 
    margin-BOTTOM: 0; 
} 

p { 
    margin-TOP: 0; 
} 
+0

이것은 작동하지 않습니다. h2와 p가 기사 안에 있기 때문에 작동하지 않는지 궁금합니다. " 응답 해 주셔서 감사합니다. – user2847948

관련 문제