The father of the son
Https://developer.mozilla.org/zh-CN/docs/Web/CSS/position
Using the sub-father phase to achieve a relatively old center way: 1. Clear width; 2. Position the left side to the middle of the container; 3.margin-left negative to move half of the element to the left, implementing the element container Center
<style>. Container{position:relative; }. Item{position:Absolute;Background-color:#0F9E5E;Display:Inline-block;width:90px; Left:50%;Margin-left:-45px;Height:10px; }</style><Divclass= "Container"> <Divclass= "Item"></Div></Div>Small Triangle
The idea is simple, is the input method to enter a diamond, and then hide half of the line.
<stylerel= "stylesheet">. Tri:before{content:' ◇ ';Line-height:1;font-size:30px;Display:Inline-block;Height:15px;Overflow:Hidden; }</style><spanclass= "tri"></span>+ and ~ Selectors
Div+p: Select a <p> element immediately after the <div> element.
P~ul: Selects all <ul> elements after the <p> element.
Scenario: Select all the elements that you think are the first one. Here are two ways to achieve
<style> /*. Item ~. Item*/. Item +. Item{Color:Red; }</style><Divclass= "Item First">1</Div><Divclass= "Item">2</Div><Divclass= "Item">3</Div><Divclass= "Item">4</Div>
Operation Result:
1234
row height and font size are the same
Line-height:1
translucent container, opaque content
Using opacity will cause the container and content to be transparent, using RGBA to make the container transparent, but the content is opaque
<style>. Container{Background-color:Rgba (99,99,99,0.5); }</style><Divclass= "Container">123131</Div>
CSS Practice Record