CSS Notes and cssnotes

Source: Internet
Author: User

CSS Notes and 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 setWidthAndHeightProperties of an element with CSS, you just set the width and height ofContent 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;

}

Wocould turnEvery paragraph that is the second child of its parent elementRed. The element that is the child goes before: nth-child; its parent element is the element that contains it.


Notes Emails: Why is the unread emails displayed as read?

Just refresh the template.

My CSS can be displayed in Dreamweaver, but it won't work after a preview. Can you help me check the code?

Is it because the URL of your background uses the path relative to the local disk? If you use drewmweaver to create a page, we recommend that you create a site in the "file" tree directory on the right, set the site path to the directory of the site you are currently developing, and then write CSS. In this way, the background URL will be automatically converted to the relative path by DW. So there will be no problem during the preview.
There is also the first line of @ charset "UTF-8"; it looks like setting up UTF-8 encoding, but, as if I have never seen a similar definition, I do UTF-8 page CSS has never used this. It may also be a problem. Try it out.
-------
The image shows how to manage the site. Add one.
If it is external css, you can set the path after the url to the directory where the relative css file is located. If it is inline, set it to the relative path of the page file.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.