一、样式基础(wxss)
在wxss文件中编写样式内容,使用class等为组建指定样式
样式的属性:
尺寸:width,height,min-width,max-width,min-height,max-height等
背景:background-color,background-image,background-repeat等
边框:border,border-radius,border-width,border-color,border-style,border等
边距:margin(), padding等
文本:color, font-size等
其他(列表、内容、表格...)
二、样式选择器
基本选择器:
1)类选择器 (.name{}))
2)ID选择器 (#name{})
3)元素选择器 (name{})
4)通配符选择器 ({})(给所有控件设置样式,小程序不能用这个)
5)包含选择器 (p c{})(p表示parent, c 是chidren)
6)子元素选择器 (p > c{})(小程序不支持,只有子层才包含,孙子层不包含)
7)临近兄弟选择器 (c + c{})
8)通用兄弟元素选择器 (c ~c{})
属性选择器:
1)E[attr]
2)E[attr="value"]
3)E[attr~="value"]
4)E[attr|="value"]
5)E[attr^="value"]
6)E[attr$="value"]
7)E[attr="value"]
伪类选择器:
1)动态伪类选择器(:link, :visited, :hover, :active, :focus)
2)状态伪类选择器 (:enabled, :disabled, :checked)
3)选择伪类选择器 (:first-child, :last-child, :nth-child(), :nth-last-child(), :nth-of-type(), :nth-last-of-type(), :first-of-type, :last-of-type, :only-child, :only-of-type)
4)空内容伪类选择器 (:empty)
5)否定伪类选择器(:not)
6)伪元素(::first-line, ::first-letter, ::before, ::after, ::selection)
微信小程序样式基础
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...