CSS 字体(font)实例

CSS 实例

  • CSS 背景实例
  • CSS 文本实例
  • CSS 字体(font)实例
  • CSS 边框(border)实例
  • CSS 外边距 (margin) 实例
  • CSS 内边距 (padding) 实例
  • CSS 列表实例
  • CSS 表格实例
  • 轮廓(Outline) 实例
  • CSS 尺寸 (Dimension) 实例
  • CSS 分类 (Classification) 实例
  • CSS 定位 (Positioning) 实例
  • CSS 伪类 (Pseudo-classes)实例
  • CSS 伪元素 (Pseudo-elements)实例

01设置文本的字体

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>01设置文本的字体</title>
<style type="text/css">
body {
background-image: url(http://images2015.cnblogs.com/blog/846157/201512/846157-20151207120828824-739848359.jpg);
}
p.serif {font-family: "Times New Roman",Georgia,Serif;}
p.sansserif {font-family: Arial,Verdana,Sans-serif;}
</style>
</head>
<body>
<h1>CSS font-family</h1>
<p class="serif">This is a paragraph, shown in the Times New Roman font.</p>
<p class="sansserif">This is a paragraph, shown in the Arial font.</p>
</body>
</html>


02设置字体尺寸

<!doctype html>
<html> <head>
<meta charset="utf-8">
<title>02设置字体尺寸</title>
<style type="text/css">
body {
background-color: #CCFFFF;
} h1 {
font-size: 300%;
} h2 {
font-size: 200%;
} p {
font-size: 100%;
}
</style>
</head> <body>
<h1>我是标题1</h1>
<h2>我是标题2</h2>
<p>我是一个段落</p>
</body> </html>


03设置字体风格

<!doctype html>
<html> <head>
<meta charset="utf-8">
<title>03设置字体风格</title>
<style type="text/css">
body {
background-color: #CCFFFF;
} h1 {
font-style: normal;
} h2 {
font-style: italic;
} p {
font-style: oblique;
}
</style>
</head> <body>
<h1>One always has time enough, if one will apply it well.</h1>
<h2>One always has time enough, if one will apply it well.</h2>
<p>One always has time enough, if one will apply it well.</p>
</body> </html>


04设置字体的异体

<!doctype html>
<html> <head>
<meta charset="utf-8">
<title>04设置字体的异体</title>
<style type="text/css">
body {
background-color: #CCFFFF;
} p.normal {
font-variant: normal;
} p.small {
font-variant: small-caps;
}
</style>
</head> <body> <p class="normal">One always has time enough, if one will apply it well.</p>
<p class="small">One always has time enough, if one will apply it well.</p>
</body> </html>


05设置字体的粗细

<!doctype html>
<html> <head>
<meta charset="utf-8">
<title>05设置字体的粗细</title>
<style type="text/css">
body {
background-color: #CCFFFF;
} p.normal {
font-weight: normal;
} p.thick {
font-weight: bold;
} p.thicker {
font-weight: 900;
}
</style>
</head> <body> <p class="normal">Where is the 哈哈 point?</p>
<p class="thick">Where is the 哈哈 point?</p>
<p class="thicker">Where is the 哈哈 point?</p>
</body> </html>


06所有字体属性在一个声明之内

<!doctype html>
<html> <head>
<meta charset="utf-8">
<title>06所有字体属性在一个声明之内</title>
<style type="text/css">
body {
background-color: #CCFFFF;
} p.sty1 {
font: italic arial, sans-serif;
} p.sty2 {
font: italic bold 20px/100px arial, sans-serif;
}
</style>
</head> <body> <p class="sty1">Where is the 哈哈 point?</p>
<p class="sty2">Where is the 哈哈 point?</br>
(我的大小20px行高100px)</p>
</body> </html>


CSS字体实例总结


W3School-CSS 字体(font)实例的更多相关文章

  1. CSS 字体(font)实例

    CSS 字体(font)实例CSS 字体属性定义文本的字体系列.大小.加粗.风格(如斜体)和变形(如小型大写字母).CSS 字体系列在 CSS 中,有两种不同类型的字体系列名称: 通用字体系列 - 拥 ...

  2. css字体样式(Font Style),属性

    css字体样式(Font Style),属性   css字体样式(Font Style)是网页中不可或缺的样式属性之一,有了字体样式,我们的网页才能变得更加美观,因此字体样式属性也就成为了每一位设计者 ...

  3. CSS(2)---css字体、文本样式属性

    css字体.文本样式属性 这篇主要讲CSS文本属性中的:字体样式属性 和 文本样式属性. 一.字体样式属性 CSS 字体属性主要包括:字体设置(font-family).字号大小(font-size) ...

  4. CSS:CSS 字体

    ylbtech-CSS:CSS 字体 1.返回顶部 1. CSS 字体 CSS字体属性定义字体,加粗,大小,文字样式. serif和sans-serif字体之间的区别  在计算机屏幕上,sans-se ...

  5. 3.CSS字体属性

    CSS Fonts(字体)属性用定义字体系列,大小粗细,和文字样式(如斜体) 3.1字体系列 CSS使用font-family属性定义文本字体系列 p { font-family:'微软雅黑' ;} ...

  6. CSS字体属性大全

    文章转自:http://www.10wy.net/Article/CSS/CSS_list_8.html查看更多更专业性的文章请到:网页设计网 CSS字体属性 字体名称属性(font-family) ...

  7. css字体图标的使用方法

    提要:对于传统的一般用css雪碧(css sprite)来搞,目前大部分网站已经主要字体图标 ,利用font+css 或者font+html 来开发,今天总结了一下,记录之~ css sprite用背 ...

  8. Css - 字体图标

    Css - 字体图标 字体格式 ttf.otf.woff.svg.eot 现在流行将图标做成矢量的字体格式的文档,很多用户在放大页面的时候页面上的普通图片格式的图标就会变得模糊不清,这种字体图标在网页 ...

  9. CSS 分类 (Classification) 实例

    CSS 分类 (Classification) 实例CSS 分类属性 (Classification)CSS 分类属性允许你控制如何显示元素,设置图像显示于另一元素中的何处,相对于其正常位置来定位元素 ...

随机推荐

  1. 修正 XE5 Android 键盘三个问题

    说明:XE5 在 Android 平台上存在这一些键盘操作的问题,目前发现有下列几种: 按键盘上的隐藏键后,无法按上一页(需要修改 XE5 源码「FMX.VirtualKeyboard.Android ...

  2. [java] StringBuilder / StringBuffer / String 建立字符串

    1.三者在建立新字符串速度方面的比较: StringBuilder >  StringBuffer  >  String 2.线程安全性: StringBuilder:线程非安全的 Str ...

  3. sp_get_menu函数使用分析

    function sp_get_menu($id="main",$effected_id="mainmenu",$filetpl="<span ...

  4. 使用Apache的Hex类实现Hex(16进制字符串和)和字节数组的互转

    包名称:org.apache.commons.codec.binary 类名称:org.apache.commons.codec.binary.Hex 1.字节数组(byte[])转为十六进制(Hex ...

  5. linux TCP: time wait bucket table overflow

    早上一台rabbitmq和Java所在的服务器,客户端反馈超级卡,看io和cpu都不高.发现六七万消息挤压,临时性问题解决之后,看/var/log/messages,发现很多TCP: time wai ...

  6. ClockPicker – 时钟风格 Bootstrap 时间选择器

    ClockPicker 是国内前端开发者发布的一个时钟样式 Timepicker,可以用于 Bootstrap 和 jQuery.所有主流浏览器都支持,包括 IE9+,支持移动设备,能够在触摸屏设备很 ...

  7. jQuery.clean()方法源码分析(一)

    在jQuery 1.7.1中调用jQuery.clean()方法的地方有三处,第一次就是在我之前的随笔分析jQuery.buildFramgment()方法里面的,其实还是构造函数的一部分,在处理诸如 ...

  8. 腾讯用过的插件jQuery twentytwenty 效果对比

    在线实例 左右对比 上下对比 使用方法 <div class="twentytwenty-container">     <img src="/api/ ...

  9. Atitit.阿里云c盘 系统盘爆满解决方案

    Atitit.阿里云c盘 系统盘爆满解决方案 Use disk parse tool to scan then C:\widnow/soursce /install.wim   迁移  3g 显示在 ...

  10. Ioc容器Autofac系列(1)-- 初窥

     一.前言 第一次接触Autofac是因为CMS系统--Orchard,后来在一个开源爬虫系统--NCrawler中也碰到过,随着深入了解,我越发觉得Ioc容器是Web开发中必不可少的利器.那么,Io ...