Home  >  Article  >  Web Front-end  >  Common questions about getting started with CSS

Common questions about getting started with CSS

WBOY
WBOYOriginal
2016-11-30 23:59:361257browse

Written before: This article briefly introduces the three major characteristics of CSS: cascading, inheritance, and priority. As well as margin, padding, floating, and positioning several knowledge points. It is limited to the level and will not be discussed in depth. It is only used as a learning summary.

1. Three characteristics

1) Cascading: If the styles conflict with the same label and the same weight, the later styles will overwrite the previous ones.

2) Inheritance: When setting the style for the parent element, the child element will be affected by the style of the parent element if it has no style by default. Note that width and height cannot be inherited.

Inheritable attributes:
◇Text color can be inherited color
◇Text-related attributes can be inherited
◆Line-height (line-height) can be inherited
text-align

Special circumstances:

a Tags are not affected by the color of the parent element by default

It is common that setting the color a tag for li when making nav does not work because it is affected by the browser's default style color: -webkit-link.

h1-h6 The default unit is em. The specific size requires product operation

3) Priority:

Tag Selectorb8e83de74e9a0593ca681d3023123498 2 body { 3 min-width: 1000px; 4 } 5 6 .columns { 7 height: 250px; 8 float: left; 9 } 10 11 .container { 12 height: 250px; 13 border: 1px solid red; 14 } 15 16 .mainbox { 17 width: 100%; 18 background: yellow; 19 } 20 21 .inner { 22 margin: 0 300px 0 250px; 23 word-break: break-all; 24 } 25 26 .leftbox { 27 width: 250px; 28 background: red; 29 margin-left: -100%; 30 } 31 32 .rightbox { 33 width: 300px; 34 background: blue; 35 margin-left: -300px; 36 } 37 531ac245ce3e4fe3d50054a55f265927

 

 

  

 

Statement:
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