Home > Article > Web Front-end > Read some summaries of "How much do you know about css"_html/css_WEB-ITnose
1. Some browsers do not fully support css3. Which tool can be used to detect whether the browser supports it and what items it supports?
modernizr: Detect the browser's HTML5 and CSS3 features (as for the introduction of modernizr, you can read my other blog post HTML5 series four (feature detection, introduction to Modernizr.js))
2. Commonly used html tags, their display attributes generally default to block and inline. What are the common tags whose display is not block or inline? What is the difference between the display of these tags and block/inline?
The specific display attribute values are as follows:
inline can be understood as a flow, which has no size or shape, and its width depends on the parent container width. For inline tags, the width and height you set are invalid.
How to convert inline elements into block-level elements
So the characteristics of inline-block can be summarized as: it looks like a "flow" from the outside, but it is indeed a "block" in itself.
3.
The first row of a table displays a red background, the last row displays a blue background, and the middle row uses a gray/white spaced background. How to write?Using structured pseudo-classes, you will write as follows
Insert a sentence here, if you want to underline between each menu, as shown in the figure below Effect
Most people will use
ul li { border-bottom: 1px solid #ccc; } ul li:last-child { border-bottom: 0px; }But in fact there is a more convenient way (if you are very familiar with structured pseudo-classes) If you understand)
ul li + li { border-top: 1px solid #ccc; }Here are the following two structural pseudo-classes:
Select the sibling node next to an element, For example, li li{…}
Clear the float and add a "triangle" to a div
In fact, many icons are generally very small (it should be small in itself), but I need this If you add event binding to small icons, it will be even worse on the mobile phone. Users cannot click it at all. What to do? You can use before and after to increase the size of the container
Another thing to mention here is css The content attribute will only work in before and after, and has no effect in other attributes. So sometimes don't write some useless attributes to your code, which will increase the browser's parsing time.
5.
css?? Cascading style sheet, how to understand the "cascading" in it?There is nothing to say about this. In fact, I have seen many blog posts saying that ID represents 100, class represents 10, and Element represents 1. I don’t agree with this explanation. If you want to really If you know more about it, you can read the "CSS Definitive Guide", or you can read CSS--Structure and Cascading
6.
The width of the box model actually refers to the width of the content, excluding padding and border. , margin. In fact, this is very detrimental to our CSS layout. Is there any way to make the width the full width?box-sizing
....
There are many other questions, I will summarize them one by one
Ideas for learning css
After the browser loads the html, it only looks for one thing?? the dom tree. The browser changes the html into a dom tree structure, thus completing the structuring of the html.
The browser turns the loaded html into a dom tree, but there is no display style at this time. Therefore, the displayed styles are all defined by CSS. The browser will only render the view style through CSS
As for the subsequent rendering of the view, p is block and br is newline. That is after integrating CSS. The browser's integration of CSS is another route, which is separate from parsing HTML.
HTML parsing is a line, CSS parsing is a line, and the two will be combined at a certain point to form the final view.
If we focus on CSS, from the above picture we can summarize three breakthrough points for learning CSS.
css style source
我之前一直到《css权威指南》里面说的用户代理样式一词很不了解,看了博主的文章后才明白,在一些浏览器是可以自定义字号和字体的(用户在这里设置了字体和字号之后,它们会覆盖掉浏览器默认的样式)。 display:table具有包裹性,除了display:table之外,float及position:absolute也都具有包裹性,什么叫包裹性,简单一点的说就是宽度会根据内容而定,包裹的特性其实主要有三个表现:收缩、坚挺、隔绝。 在没有css3的column-count之前,大家都习惯用display:table-cell来实现多列布局,但是众所周知table-cell IE6、7不兼容。 纵向margin是会重叠 用div画下三角 布局相关
div { border: 10px solid; border-color: #333 transparent transparent transparent; }
div设置了float之后,其宽度会自动调整为包裹住内容宽度,而不是撑满整个父容器。
被设置了float的元素会脱离文档流。
“清空格”这一特性的根本原因是由于float会导致节点脱离文档流结构。它都不属于文档流结构了,那么它身边的什么换行、空格就都和它没关系的,它就尽量的往一边去靠拢,能靠多近就靠多近,这就是清空格的本质。事实上这些空格并没有真正消失,只是位于float元素的后面罢了。
.clearfix:after { content: ''; display: table; clear: both; } .clearfix { *zoom: 1; }
看王朋福的css知多少系列的总结