猿问

Margin-Top不能用于span元素吗?

有人可以告诉我我编码错误吗?一切正常,唯一的是顶部没有裕度。


HTML:


<div id="contact_us"> <!-- BEGIN CONTACT US -->

  <span class="first_title">Contact</span>

  <span class="second_title">Us</span>

  <p class="content">For any questions whatsoever please contact us through the following e-mail address:</p></br></br>

  <p class="e-mail">info@e-mail.com</p></br></br></br></br>

  <p class="read_more"><a href="underconstruction.html">Read More</a></p>

</div> <!-- END CONTACT US -->

CSS:


span.first_title {

  margin-top: 20px;

  margin-left: 12px;

  font-weight: bold;

  font-size: 24px;

  color: #221461;

}


span.second_title {

  margin-top: 20px;

  font-weight: bold;

  font-size: 24px;

  color: #b8b2d4;

}   


RISEBY
浏览 770回答 3
3回答

SMILET

span元素是display:inline;在默认情况下,你需要使它inline-block或block更改您的CSS像这样span.first_title {&nbsp; &nbsp; margin-top: 20px;&nbsp; &nbsp; margin-left: 12px;&nbsp; &nbsp; font-weight: bold;&nbsp; &nbsp; font-size:24px;&nbsp; &nbsp; color: #221461;&nbsp; &nbsp; /*The change*/&nbsp; &nbsp; display:inline-block; /*or display:block;*/}
随时随地看视频慕课网APP
我要回答