Open msforest opened 7 years ago
background-clip: 规定背景的定位区域
background-origin: 规定背景图片的定位区域 值有:content-box, padding-box, border-box
transform(转换):
transition(有四个属性 默认值 all 0 ease 0) 过渡
animation(none 0 ease 0 1 normal)动画: 与keyframes结合使用
伪类/伪元素
伪类分动态伪类和静态伪类 动态伪类::focus, :hover, :active. 静态伪类::link, :visited, :first-child.
伪元素 :first-line, :first-letter, :before, :after.
nth-child/nth-of-type
flexbox-examples flex布局教程 medium
flex的两个概念:容器container和项目item 容器的6个相关属性:
flex-direction
属性和flex-wrap
属性的简写形式项目的6个相关属性:
flex-grow, flex-shrink
和flex-basis
的简写,默认值为0 1 auto
从字面意思来看,是获取计算后的style,即获取当前元素所有最终的css属性值。
css样式定义分三种:
获取这些样式的有:style / currentStyle / getComputedStyle
用法:
<style>
a {
width: 100px;
}
</style>
<a style="float:left">text</a>
<script>
document.querySelector('a').style.float // left
document.querySelector('a').style.width // ''
document.querySelector('a').style.setProperty('width', '10px', 'important')
document.querySelector('a').style.removeProperty('width')
document.querySelector('a').currentStyle.getAttribute('cssFloat') // left
document.querySelector('a').currentStyle.getAttribute('width') // 100px
document.defaultView.getComputedStyle(document.querySelector('a'), null).getPropertyValue('float') // left
document.defaultView.getComputedStyle(document.querySelector('a'), null).getPropertyValue('width') // 100px
</script>
这也是为什么很多地方都用document.defaultView.getComputedStyle,而不是直接用window.getComputedStyle。
https://www.zhangxinxu.com/wordpress/2012/05/getcomputedstyle-js-getpropertyvalue-currentstyle/ https://developer.mozilla.org/zh-CN/docs/Web/API/Window/getComputedStyle
css3 flex实例
css 选择器
getComputedStyle
选择器
分组 对不同的标签使用同一个规则
类选择器/ID选择器
列出一些特别的表达式
img[src="1.png"]{ content: attr(alt); }
img[src~="1.png"]{ // src值包含1.png content: attr(alt); }
img[src^="1.png"]{ // 以1.png开头 content: attr(alt); }
img[src$="1.png"]{ // 以1.png结尾 content: attr(alt); }
img[src*="1.png"]{ // 包含1.png content: attr(alt); }
div span{ // div元素下的所有span,不管span元素属于第几代 color: red; }
div > span{ // div元素的子span元素 color: red; }
h1 + p{ // 选择相邻兄弟元素 color: red; }