CSS:CSS樣式如何?Logo立體盒子效果

來源:互聯網
上載者:User

讓我們看一下該如何?立體盒子的效果吧,然後,我們將會給大家展示一些很好的例子。
    準備先準備好你的頁面和圖片,我們使用這張圖片:
    我們簡單的將HTML寫成這樣:

<div id="container">
 <img id="logo" src="logo.png" alt="Lee Munroe"  />
</div>
    CSS樣式可能會是這個樣子的:

body{background:#999;}
 
#container{
 width:960px;
 background:#fff;
 margin:20px auto;
 padding:10px;
}
    下面是一個效果預覽:
    設定為相對定位,當我們定位logo的時候,我們希望它的位置是相對於容器的,因此使用相對定位:
#container{
width:960px;
background:#fff;
margin:20px auto;
padding:10px;
position:relative;
}
    將它定位到盒子的外面現在你需要做的就僅僅是定位logo,將其水平定位,讓它從容器中突出出來。

#logo{
position:absolute;
left:-15px;
}
    現在,我們就可以看到,logo已經顯示在盒子之外了。

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.