Home Web Front-end HTML Tutorial Html/Css (Part 2 for Beginners)

Html/Css (Part 2 for Beginners)

Jul 06, 2016 pm 01:28 PM

1. In actual work, a team is working on the project, not one person. Multi-person collaboration means that each team has its own
naming habits.
1. Naming of css selectors should be standardized.
2. There are naming specification documents.

2. The role of css selector: specify the object (scope) that the css style is applied to
1. Tag selector: for html tags
2. id selector: for content that only appears once on the page, id
3. Class selector: for certain elements, the same style, repeated styles
***** By default, some html elements themselves have their own default values.
4. Control all elements----use wildcards----*
wildcard selector: *{attribute: value}, used to define all html elements
***** * The range of action is very wide, but its efficiency is very low. Use with caution
*{margin: 0; padding: 0;}//Reset the outer margins and inner margins of all elements to zero
5. Nested use of selectors----including selectors
The limit of front-end development is that the code is very streamlined.
6. If multiple selectors have the same style, we can form a group of these selectors at this time
Selector 1, selector 2,... {Attribute: value }
*****css selector indicates who you will use the style you defined.
/*The following selectors indicate that these selectors are grouped into a group and they all have the same style*/
body,ul,ol,li,p,hi,h2,h3,h4,h5, h6,form,fieldset,table,top a,.top,.top a,.top a:visited
/* means a*/
.top a,.top a: visited

3. CSS box model
****A box is composed of the following parts:
1. Content in the box
2. Border of the box
3. Box The distance between the border and the content is called padding, inner margin (inner patch)
4. Multiple boxes exist, and the distance between boxes is called border --margin, outer margin (External patch)

***** is the actual width of the box, for example = left and right borders, left and right borders, left and right padding content width
*****css box related attributes
[1], content attribute: content The width of the content itself = width, the height of the content itself = height
[2], padding attribute: the distance between the content and the border padding
***** When defining the width of the box, the padding should be considered , widening, the presence of boundaries.
If you add padding, the width of the entire box will be subtracted from the padding value you added. (box- can be used in css3
sizing:border-box; causes the browser to render a box with the specified width and height, and put the border and padding into the box.
)

Top of the small box=20 Right 30 Bottom 50 Left 100 Outer border
margin: 20 30 50 100;
margin-top:
margin-right:
margin-bottom:
margin-left:

***** Please pay attention to browser compatibility when using margins in the future.
*****Except when the value is 0, all non-zero values ​​must be followed by a unit.
*****We need to calculate the default inner and outer margins of all browsers from zero.
In actual work, do not use this * (margin: 0; padding: 0), which is the least efficient.
So we reset the default values ​​​​of which elements are used to zero.

Although CSS properties have inheritance characteristics, not all properties are inherited.
CSS layout is mainly implemented through the box model-w3c places web content in some boxes and adjusts some attributes of this box
Control.
Content: width height
Inner padding: padding
Outer frame: border
Outer border: margin

About the attributes of the list: --There are compatibility issues
list-style: image of the list
Syntax:
list-style: list-style-image || list-style-position | | list-style-type
The style of the list: the picture of the list, the position of the list symbol, the style of the list
list-style-none does not need the symbol of the list.

Border attribute description:
css syntax:
border: border-width||border-style||border-color
According to the syntax, infer its usage
If you only write border , then it will be followed by three different sub-elements, the first: thickness, the second: style, the third: color
Color
Border style: Two pixels thick solid blue
border: 2px solid blue

*****css tips:
[1], center the box horizontally: set the left and right boundaries of the object to auto;
[2], center the content in the box vertically: set the row Height (line-height) = height of the box, but no line breaks.
【3】When we are debugging, we can add the background color appropriately.

*****html element classification: block and inline
Background images are tiled horizontally and vertically by default.
The default background image is displayed in the upper left corner of the element.
How the background image is attached: The definition of fixed is to fix the image at a certain position on the screen (visible area).
Compatibility IE6 only supports this attribute for the two elements html and body

Tips to make you look more professional: Flip effect: In fact, the idea is to prepare two pictures of the same size but different content. Normally One will be displayed under
, and another will be displayed when the mouse passes over it. (The transform attribute is commonly used in css3 to define the flip effect of images)

Pseudo class, representing a state
: link

css wizard skills: mainly to reduce http requests[Commonly used font icons in css3 replace traditional small icons (future trend)]
Browser--server (communication) (example: Shopping supermarket--at checkout)

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Is HTML easy to learn for beginners? Is HTML easy to learn for beginners? Apr 07, 2025 am 12:11 AM

HTML is suitable for beginners because it is simple and easy to learn and can quickly see results. 1) The learning curve of HTML is smooth and easy to get started. 2) Just master the basic tags to start creating web pages. 3) High flexibility and can be used in combination with CSS and JavaScript. 4) Rich learning resources and modern tools support the learning process.

What is the purpose of the <progress> element? What is the purpose of the <progress> element? Mar 21, 2025 pm 12:34 PM

The article discusses the HTML &lt;progress&gt; element, its purpose, styling, and differences from the &lt;meter&gt; element. The main focus is on using &lt;progress&gt; for task completion and &lt;meter&gt; for stati

The Roles of HTML, CSS, and JavaScript: Core Responsibilities The Roles of HTML, CSS, and JavaScript: Core Responsibilities Apr 08, 2025 pm 07:05 PM

HTML defines the web structure, CSS is responsible for style and layout, and JavaScript gives dynamic interaction. The three perform their duties in web development and jointly build a colorful website.

What is the purpose of the <datalist> element? What is the purpose of the <datalist> element? Mar 21, 2025 pm 12:33 PM

The article discusses the HTML &lt;datalist&gt; element, which enhances forms by providing autocomplete suggestions, improving user experience and reducing errors.Character count: 159

What is the purpose of the <meter> element? What is the purpose of the <meter> element? Mar 21, 2025 pm 12:35 PM

The article discusses the HTML &lt;meter&gt; element, used for displaying scalar or fractional values within a range, and its common applications in web development. It differentiates &lt;meter&gt; from &lt;progress&gt; and ex

What is an example of a starting tag in HTML? What is an example of a starting tag in HTML? Apr 06, 2025 am 12:04 AM

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

Understanding HTML, CSS, and JavaScript: A Beginner's Guide Understanding HTML, CSS, and JavaScript: A Beginner's Guide Apr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Gitee Pages static website deployment failed: How to troubleshoot and resolve single file 404 errors? Apr 04, 2025 pm 11:54 PM

GiteePages static website deployment failed: 404 error troubleshooting and resolution when using Gitee...

See all articles