18-Bootstrap 全局 css 样式-辅助类|学习笔记

简介: 快速学习18-Bootstrap 全局 css 样式-辅助类

开发者学堂课程【前端开发框架Bootstrap使用教程18-Bootstrap 全局 css 样式-辅助类】学习笔记,与课程紧密联系,让用户快速学习知识。

课程地址https://developer.aliyun.com/learning/course/360/detail/4237


18-Bootstrap 全局 css 样式-辅助类


目录

一、情景文本颜色

二、情景背景色

三、关闭按钮

四、三角符号

五、快速浮动

六、让内容块居中

七、清除浮动

八、显示或隐藏内容

九、屏幕阅读器和键盘导航

十、图片替换


一、情境文本颜色

通过颜色来展示意图,Bootstrap 提供了一组工具类。这些类可以应用于链接,并且在鼠标经过时颜色可以还可以加深就像默认的链接一样。

处理差异

处理差异

Sometimes emphasis classes cannot be applied due to the specificity of another selector. In most cases, a sufficient workaround is to wrap your text in a <span> with the class.

 

Conveying meaning to assistive technologies

Using color to add meaning only provides a visual indication,which will not be conveyed to users of assistive technologies -such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (the contextual colors are only used to reinforce meaning that is already present in the text/markup or is included through alternative means, such as additional text hidden with the .sr-onlyclass

二、情境背景色

和情境文本颜色类一样,使用任意情境背景色类就可以设置元素的背景。链接组件在鼠标经过时颜色会加深,就像上面所讲的情境文本颜色类一样。

处理差异

处理差异

Sometimes contextual background classes cannot be applied due to the specificity of ano-ther selector. In some cases, a sufficient workaround is to wrap your element’s content  in a <div> with the class

 

Conveying meaning to assistive technologies

As with contextual colors,ensure that any meaning conveyed through color is also convey-ed in a format that is  not purely presentational


三、关闭按钮

通过使用一个象征关闭的图标,可以让模态框和警告框消失。


四、三角符号

通过使用三角符号可以指示某个元素具有下拉菜单的功能。注意,向上弹出式菜单中的三角符号是反方向的。


五、快速浮动

通过添加一个类可以将任意元素向左或向右浮动。eportant 被用来明确 CSS 样式的优先级,这些类还可以作为mixin(参见 less 文档)使用。不能用于导航条组件中

排列导航条中的组件时可以使用这些工具类;,navbar-left 或,navbar-right 。参见导航条文档以获取更多信息。


六、让内容块居中  

为任意元素设置 display: biock 属性并通过 margio 属性让其中的内容居中。下面列出的类还可以作为 mixin 使用。


七、清除浮动

通过为父元素添加 .clearfix 类可以很容易地清除浮动(float)。这里所使用的是 Nicolas Gallagher 创造的 microclearfix 方式。此类还可以作为 mixin 使用。


八、显示或隐藏内容

.show 和.hidden 类可以强制任意元素显示或隐藏(对于屏幕阅读器也能起效)。这些类通过 !Iimportant 来避免 CSS 样式优先级问题,就像 quick floats 一样的做法。注意,这些类只对块级元素起作用,另外,还可以作为 mixin 使用。

.hide 类仍然可用,但是它不能对屏幕阅读器起作用,并且从 v3.0.1版本开始就不建议使用了。请使用.hidden 或 .sr-only.

另外,.invisible 类可以被用来仅仅影响元素的可见性,也就是所,元素的 display 属性不被改变,并且这个元素仍杰能够影响文档流的排布。


九、屏幕阅读器和键盘导航

.sr-only 类可以对屏幕阅读器以外的设备隐藏内容I.sr-only 和 .sn-only-focusable 联合使用的话可以在元素有焦点的时候再次显示出来(例如,使用键盘导航的用户)。对于遵循 可访问性的最佳实践很有必要。这个类也可以作为 mixin 使用。


十、图片替换

使用.text-hide 类或对应的 mixin 可以用来将元素的文本内容替换为一张背景图。

相关文章
N..
|
25天前
|
开发框架 前端开发 UED
Bootstrap的CSS组件
Bootstrap的CSS组件
N..
13 0
|
1月前
|
前端开发
web前端开发-----CSS样式设置
web前端开发-----CSS样式设置
30 0
|
1月前
|
前端开发 JavaScript
css之伪类hover改变自身、子元素、其他元素的样式
css之伪类hover改变自身、子元素、其他元素的样式
27 0
|
1月前
|
前端开发 JavaScript
webpack成长指北第7章---webpack的css\less\scss样式打包
webpack成长指北第7章---webpack的css\less\scss样式打包
41 0
|
8天前
|
前端开发
|
11天前
|
移动开发 前端开发
【通用CSS模板】移动端H5页面统一样式.css
【通用CSS模板】移动端H5页面统一样式.css
|
15天前
|
XML 前端开发 数据格式
css添加样式
【4月更文挑战第4天】css添加样式
20 9
|
1月前
|
JavaScript 前端开发
如何在 Vue 中进行样式绑定和scoped CSS?
如何在 Vue 中进行样式绑定和scoped CSS?
15 0
|
1月前
|
前端开发
uni-app中基于bootstrap的css样式
uni-app中基于bootstrap的css样式
22 0