博大精深的css(1) –新發現

來源:互聯網
上載者:User

1.絕對單位和相對單位:    px  和  em  (學習了,呵呵)

 

1. 代碼:

<p style="background: #900; color: #00f; font: bold 12px/24px Helvertica,Arial,sans-serif; height:24px; width:370px;">Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>
<br/>
<br/>
<p style="background: #090; color: #00f; font: bold 12px/2em Helvertica,Arial,sans-serif; height:2em; width:370px; overflow: hidden;">Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</p>

1.效果:

上一個高度是用的絕對單位px,並且沒有隱藏溢出,下一個高度用的單位是相對單位em,並且隱藏了溢出。

如果你的瀏覽器支援放大字型,那麼盡情地放大字型,看看會出現什麼效果。

 

 

2.

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.