CSS Notes,cssnotes

來源:互聯網
上載者:User

CSS Notes,cssnotes

Margin vs. Padding

Margin is on the outside of block elements while padding is on the inside. Use margin to separate the block from things outside it. Use padding to move the contents away from the edges of the block. Enter image description here:

When elements needs space between them, better to use margins. When text or an inner element needs space between the parent box and itself go for paddings.

 

Width & Height

When you set the width and height properties of an element with CSS, you just set the width and height of the content area. To calculate the full size of an element, you must also add the padding, borders and margins.

 

/* It will only have effect on the link in this page */

#this-page a:hover {

    ...

}

 

nth-child

You can actually select any child of an element after the first child with the pseudo-class selector nth-child; you just add the child's number in parentheses after the pseudo-class selector. For example,

p:nth-child(2) {

    color: red;

}

would turn every paragraph that is the second child of its parent element red. The element that is the child goes before :nth-child; its parent element is the element that contains it.


Notes郵件問題,未讀取的郵件顯示為已經讀取?

重新整理一下模板就好了
 
我的CSS在Dreamweaver裡可以顯示但是一預覽就不行了幫我看看代碼哈

是不是因為你背景的URL用了相對本地磁碟的路徑?如果是用drewmweaver做的頁面,建議你在右邊“檔案”樹型目錄這裡建立一個網站,把網站路徑設定為你當前開發的這個站的目錄,然後再去寫CSS。這樣背景URL這裡就DW就會自動轉為相對路徑。那麼在預覽的時候就不會有問題了。
還有第一行的@charset "utf-8";看起來好象是設定UTF-8編碼,但是,我好象從來沒見過類似的定義,我做UTF-8頁面的CSS從來沒用過這個。也可能是這裡出了問題。去掉試一下吧。
-------
圖片示範那裡點管理網站。添加一個。
不添也行,如果是外聯的css,那麼url後面的路徑設定成相對css檔案所在目錄就可以了。如果內聯的,設定成該分頁檔相對的路徑。



 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.