文本属性

设置文本颜色:

<style type="text/css">
body {color:red}
h1 {color:#00ff00}
p.ex {color:rgb(0,0,255)}
</style>

设置文本背景颜色:

<style type="text/css">
span.highlight
{
background-color:yellow
}
</style>

设置字符间距:

<head>
<style type="text/css">
h1 {letter-spacing: -0.5em}
h4 {letter-spacing: 20px}
</style>

设置行间距的三种方法:

1.百分比

<head>
<style type="text/css">
p.small {line-height: 90%}
p.big {line-height: 200%}
</style>

在大多数浏览器中默认行高大约是 110% 到 120%。

2.像素

<style type="text/css">
p.small
  {
  line-height: 10px
  }
p.big
  {
  line-height: 30px
  }
</style>

在大多数浏览器中默认行高大约是 20px。

3.数值

<style type="text/css">
p.small
{
line-height: 0.5
}
p.big
{
line-height: 2
}
</style>

默认行高大约是 1。

对齐文本:

<style type="text/css">
h1 {text-align: center}
h2 {text-align: left}
h3 {text-align: right}
</style>

修饰文本

<style type="text/css">
h1 {text-decoration: overline}
h2 {text-decoration: line-through}
h3 {text-decoration: underline}
h4 {text-decoration:blink}
a {text-decoration: none}
</style>
text-decoration:blink 定义闪烁的文本

缩进文本:
<head>
<style type="text/css">
p {text-indent: 1cm}
</style>

允许使用负值。如果使用负值,那么首行会被缩进到左边。

控制文本中的字母:

<style type="text/css">
  h1 {text-transform: uppercase}
  p.uppercase {text-transform: uppercase}
  p.lowercase {text-transform: lowercase}
  p.capitalize {text-transform: capitalize}
</style>
text-transform: capitalize 首字母大写

在元素中 禁止文本折行

<style type="text/css">
p
{
white-space: nowrap
}
</style>

增加单词 间距

<style type="text/css">
p.spread {word-spacing: 30px;}
p.tight {word-spacing: -0.5em;}
</style>

文本属性

时间: 2024-08-09 02:39:51

文本属性的相关文章

学习css之文本属性

css3之文本属性: 1.缩进和水平对齐:text-indent, 通过使用 text-indent 属性,所有元素的第一行都可以缩进一个给定的长度,甚至该长度可以是负值. 这个属性最常见的用途是将段落的首行缩进,下面的规则会使所有段落的首行缩进6 em:p {text-indent:6em;} text-indent 属性可以继承. 2.水平对齐:text-align 是一个基本的属性,它会影响一个元素中的文本行互相之间的对齐方式. 取值范围:{left:把文本排列到左边.默认值:由浏览器决定

CSS 文本属性与值

HTML编辑文本,通过CSS的设置属性赋予HTML网页活力,改变文字类型.背景以及插入图片.视频.音频等,使网页更具生动. CSS中的文本属性 font-weight: bold; //改变字体粗细 normal //正常字体.标准字体 font-style:oblique; //字体风格(oblique倾斜) text-decoration:underline; //文字修饰(underline 下划线) overline; (上划线) line-throug; (删除线) none; (取消

css常用文本属性

[CSS常用文本属性] 1. 字体.字号类: ① font-weight: 字体粗细. bold-加粗.normal-正常.lighter-细体 也可以使用100-900数值,400表示normal,700表示bold ② font-style: 字体样式. italic-倾斜.normal-正常 ③ font-size: 字号. 可以写px单位,也可以写% 200%表示浏览器默认大小(16px)的两倍=32px ④ font-family: 字体系列(字体族). >>> 可以直接写字体

文本属性Attributes

文本属性Attributes 1.NSKernAttributeName: @10 调整字句 kerning 字句调整 2.NSFontAttributeName : [UIFont systemFontOfSize:_fontSize] 设置字体 3.NSForegroundColorAttributeName :[UIColor redColor] 设置文字颜色 4.NSParagraphStyleAttributeName : paragraph 设置段落样式 5.NSMutablePar

项目复习期总结3:CSS引入方式,注释,命名规范,背景,行高,文本属性

目录: 1.CSS注释的书写 怎么写?好处? 2.CSS引入方式  各种的优缺点 3.选择器的写法与选择器的优先级 4.CSS命名规范 5.背景,行高 6.文本(text与font开头)等所有属性 ① CSS注释书写规范: 1.单行注释:    直接写在属性值的后面,如: ① .search{ border:1pxsolid#fff;/*定义搜索输入框边框*/ background:url(../images/icon.gif)no-report#333;/*定义搜索框的背景*/ } ② .wr

08.05 边框图片 盒子倒影 新增属性 文本阴影 文本属性 文本换行 文本溢出 文本修饰 文字描边 其他属性

---恢复内容开始--- ### 边框图片 * border-image-source   图片地址 * border-image-slice     图片截取方式 值 浮点数/百分比 * border-iamge-width   边框图片厚度  值 长度单位 * border-image-outset   外延   值 长度单位 * borde-image-repeat    延伸方式  值 stretch/repeat/round/space * border-image border-im

css 文本属性详细总结

CSS 文本属性可定义文本的外观. 通过文本属性,您可以改变文本的颜色.字符间距,对齐文本,装饰文本,对文本进行缩进,等等. 1,text-align 横向排列,也就是水平对齐 它会影响一个元素中的文本行互相之间的对齐方式 属性值有:left(默认),center,right p{ text-align:right } text-align:center 与 <CENTER> 您可能会认为 text-align:center 与 <CENTER> 元素的作用一样,但实际上二者大不相

Attributes:文本属性 和NSAttributedString

前言: 有一些控件无法直接设置文本大小,需要使用方法 setTitleTextAttributes 来设置文本属性 UIFont 字体样式 [UIFont fontWithName~]; iOS- 详解文本属性Attributes - 清澈Saup - 推酷 UIBarButtonItem *rightBarItem = [[UIBarButtonItem alloc] initWithTitle:@"任务" style:UIBarButtonItemStylePlain target

一些简单的文本属性

<style> /*!!!!!可以设置文本的行高等于它容器的高度, 可以实现文本的垂直方向对齐*/ #div1{ font-weight: bold; font-size: 18px; font-family: 宋体;/*字体系列*/ font-style: italic;/*italic:斜体*/ color: blue;/*字体颜色*/ opacity: 0.5;/*透明度*/ height: 100px; background-color: lightgoldenrodyellow; l

NSAttributedString.h 中文本属性key的说明-06

//NSAttributedString.h 中文本属性key的说明 /* NSFontAttributeName 设置字体属性,默认值:字体:Helvetica(Neue) 字号:12 NSForegroundColorAttributeName 设置字体颜色,取值为 UIColor对象,默认值为黑色 NSBackgroundColorAttributeName 设置字体所在区域背景颜色,取值为 UIColor对象,默认值为nil, 透明色 NSLigatureAttributeName 设置