'Those Things About CSS' Reading Notes_html/css_WEB-ITnose
Note:
Learn CSS patiently and master the essential principles of CSS, and you will find that CSS is really fun.
The best way to learn CSS is to keep doing it, keep thinking, and keep practicing.
CSS features:
Abbreviation for CSS:
CSS selector:
Pseudo class:
Used to specify the status of one or more selectors related to it (IE6/7 support part). Its form is: selector: pseudo-class {attribute: attribute value;}.
Such as: a:link{}, a:visited{}, a:hover{}, a:active{}.
Pseudo-classes can add more interactive effects to the page without having to use too much javascript to assist the implementation.
Pseudo object:
refers to the additional information to create a document in addition to the information specified in the html document (IE6/7 support part) . Its form: selector:pseudo-object {property:property value;}.
For example: p:before {content: "April 1st"}.
The characteristic of CSS cascading style sheets is "cascading". The so-called cascading means that CSS style sheets will superimpose or cover styles with each other based on the use of selectors.
Four styles defined by web pages:
Priority order adopted by CSS styles:
Selector priority points:
对于 !important关键字的使用一定要谨慎,切勿随便使用,避免产生不必要的问题。
内嵌样式表,一般应用在访问量比较大的页面 减少对服务器的http请求数而减少对服务器的负担。
缺点是如果需要修改,那就只能对页面进行修改, 且无法利用浏览器缓存特性。
由于浏览器最后解析@import,这样很容易导致IE6的闪屏或者在打开页面的过程中无样式,直到页面加载完毕后才会加载样式的现象出现,因此 不建议使用@import。
Because the browser analyzes the html code sentence by sentence from top to bottom, the main function of placing the mainBox before the sideBox is to display the content area in the browser in advance.
When using CSS styles to layout the page structure, if you do not use floating, you can only use positioning to layout the page.
Two-column page layout:
Key points: float, width specification, :after clear float.
Effect: http://jsfiddle.net/XianfaLang/tWvph/
Premise: The sum of the box model widths of the two columns cannot be greater than the width of the parent element, otherwise misalignment will occur.
Key points: float, width percentage, :after clear float.
Effect: http://jsfiddle.net/XianfaLang/MyfXs/
Key points: relative positioning, negative margin effect: http://jsfiddle .net/XianfaLang/U3J3X/
Problem: When the sideBox has a lot of content, using absolute positioning will not expand the height of the parent element, and will cover the content of other elements. The solution is to use JavaScript to re-judge the height of the parent element. I personally think there should be a CSS solution to solve this problem instead of using JavaScript to solve it. No, Chapter 5 gives a solution: http://jsfiddle.net/XianfaLang/5w8MD/
4.1. Background simulation: using background images Tiling creates a visual effect of equal heights.
4.2. Negative margin implementation (recommended):
Principle: Use the left and right margins to compensate for the misalignment of the layout on the page.
Key points: The two containers set margin-bottom:-9999px; padding-bottom:9999px, and the parent element sets overflow:hidden;
Effect: http://jsfiddle.net/XianfaLang/Q5nph /
Problem: If the page uses for page jump, some text information will be hidden. If you place the background image at the bottom of mainBox or sideBox, the background image will not be visible.
4.3. Border simulation:
Key points: border-right:280px solid #AAAAAA; Absolute positioning
Effect: http://jsfiddle.net/XianfaLang/tLmTc/
4.4. JS method:
Key points: Use javascript to set the height of the two columns to be the same.
Effect: http://jsfiddle.net/XianfaLang/C9XcZ/
Three or more columns layout:
Key points: float, negative margin, mainBox’s width is 100 %.
Effect: http://jsfiddle.net/XianfaLang/dsfKU/
Key points: floating, margin percentage, negative margin.
Effect: http://jsfiddle.net/XianfaLang/nB57t/
The principle is similar to that of two columns of equal height, and there are 4 ways to implement it. Here are only two types:
Negative margin implementation: http://jsfiddle.net/XianfaLang/hRq2q/
Border simulation: http://jsfiddle.net/XianfaLang/EBww5/
Text-related
a. Use text-indent/line-height to "push" the text out of the container.
b. visibility: hidden; Set the element to be invisible, but occupy space.
c. display: none; Set the element to be invisible and occupy no space.
Picture related
Advantages of PNG:
PNG Disadvantages: Does not support animation effects.
PNG-8 is a little smaller than GIF. GIF can animate but PNG-8 cannot achieve animation effects.
PNG-24 is the most colorful image and supports alpha channel transparency, unlike PNG-8 and GIF which can only support fully transparent images.
Supports the transparency of alpha channel, which can make the picture have a translucent effect and make the page more beautiful.
Which format of picture should be used as a reference point for the background image:
Background-position Note:
CSS Sprite is often used to merge frequently used graphic elements.
CSS Sprite Notes:
Mixed graphics and text: Set float for : left;
Three types of lists:
- ...
- ... .
- title
- content
Inline elements do not have width and height attributes. They only have width and height attributes after they are converted into block-level elements.
In CSS styles, there are only two ways to arrange block elements horizontally: positioning and floating.
CSS achieves performance effects, and javascript achieves behavioral effects.
CSS styles require everyone to constantly explore and try new content to improve everyone's understanding of CSS styles and their ability to deal with problems.
List example:
Key points: overall width, first-level list width and height, and Floating and secondary lists are absolutely positioned.
Effect: http://jsfiddle.net/XianfaLang/4CPdG/
Key points: overall width, floating.
Effect: http://jsfiddle.net/XianfaLang/KM7Ua/
Understanding, analysis, and summary are necessary steps:
In IE browser, the vertical alignment relationship between the button and the text is like the alignment relationship between the check box and the text, which needs to be adjusted using vertical-align.
Table related
border-collapse: Retrieve or set whether the rows of the table and the sides of the cells are merged together. Default value: separate. Merge: collapse.
You can use adjacent selectors to change colors on alternate lines. Personally, I feel that this knowledge point is mainly about understanding the application of adjacent selectors, and has little practical application.
Calendar table production: http://jsfiddle.net/XianfaLang/Z4wVQ/2/
Use the table tag to display the data structure, not for Page layout.
float displays the elements on the page side by side in the horizontal direction, while position displays them The elements of the page are displayed in the form of superimposed .
A few questions to consider before using CSS filters:
The "tab" implemented using iframe has gradually evolved into integrating the page content into one, and switching the display content through JS.
To implement tabs, you need to grasp the subtle relationship between html structure and css style.
Application of negative margins and cascading effect: weird navigation menu.
The IE browser will generate a few pixels of space between each list li. You can use float:left; to make the extra few pixels "disappear".
The best way to analyze an example is to simplify it and understand and analyze the problem fundamentally.
Clear floating effect:
Common methods to clear floats:
1. clear attribute--common clear: both;
2. Add Additional tags:
3. Use the br tag and its own html attribute:
4. Parent element settings: overflow: hidden; *zoom:1; (hasLayout also needs to be triggered in IE6, such as zoom: 1)
5. Parent element settings: display: table;
6. Parent element settings :after pseudo-class (recommended):
.clearFix:after { clear: both; /* 清除伪类层以上的浮动 */ display: block; /* 使生成的元素以块级元素显示,占满剩余空间; */ visibility: hidden; /* 设置伪类层内容为块级元素且不可见 */ height: 0; line-height: 0; /* 设置伪类层中的高度和行高为0 */ content: " "; /* 将伪类层中的内容清空 */}.clearFix { zoom: 1; /* 针对IE浏览器产生hasLayout效果清除浮动 */}
Structural analysis is the first step in page creation.
Users are accustomed to scroll bars moving up and down, not left and right.
If the image is large, cut it into two images.
Advantages of using semantic XHTML tags:
Share your work and express gratitude to the person who criticized your work, because he is telling you how to do better.
How to improve your ability to write code:

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

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.

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.

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

AnexampleofastartingtaginHTMLis,whichbeginsaparagraph.StartingtagsareessentialinHTMLastheyinitiateelements,definetheirtypes,andarecrucialforstructuringwebpagesandconstructingtheDOM.

The Y-axis position adaptive algorithm for web annotation function This article will explore how to implement annotation functions similar to Word documents, especially how to deal with the interval between annotations...

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

HTML, CSS and JavaScript are the three pillars of web development. 1. HTML defines the web page structure and uses tags such as, etc. 2. CSS controls the web page style, using selectors and attributes such as color, font-size, etc. 3. JavaScript realizes dynamic effects and interaction, through event monitoring and DOM operations.

To achieve the effect of scattering and enlarging the surrounding images after clicking on the image, many web designs need to achieve an interactive effect: click on a certain image to make the surrounding...
