Distinguishing between HTML and properties in CSS

Source: Internet
Author: User

The difference between ID and class in CSS

1, when writing in the CSS file, the ID prefix "#", Class with "." 2, id a page can only be used once; class can be referenced more than once. 3, ID is a label, used to distinguish between different structure and content, like a name, if a room has 2 people with the same name, there will be confusion; class is a style that can be set on any structure and content, like a garment; 4, conceptually is not the same: ID is to find the structure/content, and then define the style, class is defined first a style, and then set to multiple structures/content. The current browser also allows multiple identical IDs to be displayed normally, but when you need to use JavaScript to control the DIV with an ID, an error occurs. the difference between margin and padding

Boundary (margin): An extra white space is generated around the element. "White space" is usually the area where other elements cannot appear and the background of the parent element is visible.

Padding is called the inner margin, which is judged by the distance of the border from the body of the content, and I like the CSS authoritative guide explaining the "filler" (or "white"), because he is very image. Filler (padding): The padding is between the boundary of the element box and the content area. Naturally, the attribute used to affect this area is padding.

the difference between div and span

The greatest feature of DIV and SPAN elements is that no formatting renders to objects within an element by default. Allows multiple nesting to be used primarily to apply style sheets (common denominator).

The most obvious difference between the two is that the div is a block element, and span is an inline element (also translated into embedded elements).

1. The so-called block element is the element that starts to render on a different line, and the inline element does not need another line.

Convert by setting the display property of both to one of the following.

Inline: Default. This element is displayed as an inline element with no line break before or after the element. Block: Specifies that the object is a block element with a newline character before and after this element.

The difference between src and href
SRC is the source that points to the object
HREF is the point where you need to connect.
For example 
is SRC take image.jpg as the source file of this img ... Is shows Image.jpg's meaning
For example <a href= "Image.jpg"/>
is the href jump to image.jpg ... Is the URL will jump to image.jpg meaning
the difference between font-family and font-face in CSS in CSS, margin refers to the distance from its own border to the border of another container, which is the outer distance of the container. In CSS, padding refers to the distance between the inner border of another container within itself and the inside of the container.

Distinguishing between HTML and properties in CSS

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.