分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 前端开发

2.Bootstrap 全局CSS样式和字体图标

发布时间:2023-09-06 01:28责任编辑:郭大石关键词:CSSBootstrap

一.全局CSS样式

1.html5文档类型,标准,参照下面的进行设置

<!DOCTYPE html><html lang="zh-CN"> ?...</html>

2.移动设备优先 bootstrap是移动设备优先的!

为了确保适当的绘制和触屏缩放,需要在<head>之中添加viewport元数据标签.

<meta name="viewport" content="width=device-width, initial-scale=1">

**通过视口(viewport)设置meta属性为 user-scalable=no 可以禁用其缩放功能.

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

3.排版与链接

Bootstrap 排版、链接样式设置了基本的全局样式。分别是:

  • 为 body 元素设置 background-color: #fff;
  • 使用 @font-family-base@font-size-base 和 @line-height-base 变量作为排版的基本参数
  • 为所有链接设置了基本颜色 @link-color ,并且当链接处于 :hover 状态时才添加下划线

这些样式都能在 scaffolding.less 文件中找到对应的源码.

4.Normalize.css

5.布局容器

.container 类用于固定宽度并支持响应式布局的容器。

<div class="container"> ?...</div>

.container-fluid 类用于 100% 宽度,占据全部视口(viewport)的容器

<div class="container-fluid"> ?...</div>

......

二.字体图标

创建一个嵌套的<span>标签,并将图标类应用到这个<span>标签上!!!

**图标类只能应用在不包含任何文本内容或子元素的元素上.只对内容为空的元素其作用!!

**为了设置正确的内补(padding),务必在图标和文本之间添加一个空格.

<!doctype html> <!--HTML5的文档--><html lang="en"> <!--语言--> <head> ?<meta charset="UTF-8"> <!--编码格式--> ?<meta http-equiv="X-UA-Compatible" content="IE=edge"> <!--IE浏览器的解析模式--> ?<meta name="viewport" content="width=device-width, initial-scale=1"> <!--视窗设置--> ?<meta name="Generator" content="EditPlus?"> ?<meta name="Author" content=""> ?<meta name="Keywords" content=""> ?<meta name="Description" content=""> ?<title>Document</title> ?<!-- 1.Bootstrap 层叠样式表 --> ?<link href="css/bootstrap.min.css" rel="stylesheet"> ?<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> ???<!-- WARNING: Respond.js doesn‘t work if you view the page via file:// --> ???<!--[if lt IE 9]> ?????<script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script> ?????<script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script> ???<![endif]--> </head> <body> ?<!--字体图标 下面这个!--> ?<span class="glyphicon glyphicon-send"></span> ???<!-- 2.jQuery库,必须在加载Bootstrap.min.js之前--> ???<script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script> ???<!-- 3.加载bootstrap的核心js库 --> ???<script src="js/bootstrap.min.js"></script> </body></html>

http://www.bootcss.com/

2.Bootstrap 全局CSS样式和字体图标

原文地址:http://www.cnblogs.com/youguess/p/7989950.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved