CSS中的文本格式

CSS文字格式 (CSS text formatting)

CSS text properties allow you to style your text in various ways very easily. Such as color, alignment, spacing, direction, etc.

CSS文本属性使您可以轻松地以各种方式设置文本样式。 例如颜色 , 对齐方式 , 间距 , 方向等。

文字颜色(颜色属性) (Text Color (color property))

The color property is defined by the CSS. We can either write the name of the color or the color code to use our color on the site.

color属性由CSS定义。 我们可以在网站上写下颜色的名称或颜色代码以使用我们的颜色。

Syntax:

句法:

    Element{
color:white; //#000000
}

Example:

例:

<!DOCTYPE html>
<head>
<style>
h1 {
color: red;
}
p {
color: green;
}
</style>
</head>
<html>
<body>
<p>HELLO WORLD!</p>
<h1>HEADING</h1>
</body>
</html>

Output

输出量

text formatting in CSS Example Output 1

文本对齐(text-align属性) (Text Alignment (text-align property))

text-align property is used to align text horizontally. The possible values of this property could be: left, right, center, justify and inherit.

text-align属性用于水平对齐文本。 该属性的可能值为: left , right , center , justify和Inherit 。

Syntax:

句法:

    Element{
text-align:right;
}

Example:

例:

<!DOCTYPE html>
<head>
<style>
h1 {
Text-align: center;
}
p {
Text-align: right
}
</style>
</head>
<html>
<body>
<p>HELLO WORLD!</p>
<h1>HEADING</h1>
</body>
</html>

Output

输出量

text formatting in CSS Example Output 2

文字修饰(文字装饰属性) (Text Decoration (text-decoration property))

The text-decoration property is used to remove or set decorations from the text. The possible values of this property could be: none, underline, overline, blink, line-through and inherit.

文本装饰属性用于从文本中删除或设置装饰。 该属性的可能值为: none , 下划线 , overline , blink , line-through和Inherit 。

Syntax:

句法:

    Element{
text-decoration: overline;
}

Example:

例:

<!DOCTYPE html>
<head>
<style>
h1 {
text-decoration: none;
}
h2 {
text-decoration: overline;
}
</style>
</head>
<html>
<body>
<h1>HELLO WORLD!</h1>
<h2>HEADING</h2>
</body>
</html>

Output

输出量

text formatting in CSS Example Output 3

文本转换(text-transform属性) (Text Transformation (text-transform property))

The text-transform property is used to change the cases of the text for example, it sets the case to lowercase or uppercase or just makes the initial letter capital. Possible values could be: none, capitalize, lowercase, uppercase and inherit.

text-transform属性用于更改文本的大小写,例如,将大小写设置为小写或大写,或者仅使首字母大写。 可能的值可以是: none , 大写 , 小写 , 大写和Inherit 。

Syntax:

句法:

    Element{
text-transform: none;
}

Example:

例:

<!DOCTYPE html>
<head>
<style>
p {
text-transform: uppercase;
}
</style>
</head>
<html>
<body>
<p> Some content</p>
</body>
</html>

Output

输出量

text formatting in CSS Example Output 4

文字缩进(text-indent属性) (Text Indentation (text-indent property))

The text-indent property comes in use when we have to indent the first line of text of any element. This property comes with the following values: percentage, length (specifying space) and inherit.

当我们必须缩进任何元素的第一行文本时,将使用text-indent属性。 此属性具有以下值: percent , length (指定空间)和Inherit 。

Syntax:

句法:

    Element{
text-indent: 50%;
}

Example:

例:

<!DOCTYPE html>
<head>
<style>
p {
text-indent: 100px;
}
</style>
</head>
<html>
<body>
<p> Some content</p>
</body>
</html>

Output

输出量

text formatting in CSS Example Output 5

字间距(字间距属性) (Word Spacing (word-spacing property))

The word-spacing property deals with the spacing between the words. Possible values are: length, normal and inherit.

单词间距属性处理单词之间的间距。 可能的值为: length , normal和Inherit 。

Syntax:

句法:

    Element{
word-spacing: 20px;
}

Example:

例:

<!DOCTYPE html>
<head>
<style>
p {
word-spacing: 50px;
}
</style>
</head>
<html>
<body>
<p> Some content</p>
</body>
</html>

Output

输出量

text formatting in CSS Example Output 6

字母间距(字母间距属性) (Letter Spacing (letter-spacing property))

The letter-spacing is a very useful property when it comes to putting spaces between the letters of the words. This can also have negative values as well. Its values are the same as word-spacing: normal, length and inherit.

当在单词的字母之间放置空格时, 字母间距是非常有用的属性。 这也可以具有负值。 它的值与单词间距相同: normal , length和Inherit 。

Syntax:

句法:

    Element{
letter-spacing: 10px;
}

Example:

例:

<!DOCTYPE html>
<head>
<style>
h1 {
letter-spacing: -3px;
}
</style>
</head>
<html>
<body>
<h1>Some content</h1>
</body>
</html>

Output

输出量

text formatting in CSS Example Output 7

线高(线高属性) (Line Height (line-height property))

The line-height or leading property defines the height of a line of a text. Its possible values are length, percentage, inherit, number and normal.

line-height或Leading属性定义文本行的高度。 它的可能值是长度 , 百分比 , 继承 , 数字和正常 。

Syntax:

句法:

    Element{
line-height:50%;
}

Example:

例:

<!DOCTYPE html>
<head>
<style>
p {
letter-spacing: 3px;
}
</style>
</head>
<html>
<body>
<h1>Test page</h1>
<p>
IncludeHelp site is specially designed to provide help to students, 
working professionals and job seekers. We are fully dedicated to make each tutorial 
very simple to learn and understand. This site is not created for business purpose, 
but for spreading education about programming languages and to help the concerned learners 
out who are enthusiastic to learn new technologies.
</p>
</body>
</html>

Output

输出量

text formatting in CSS Example Output 8

翻译自: https://www.includehelp.com/code-snippets/text-formatting-in-css.aspx

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/377406.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

【C++基础】重抛异常与异常的使用场景

重抛异常 异常处理程序可以重新抛出异常。 当它无法处理该异常&#xff0c;或想通知它的调用者发生了一个异常&#xff0c;此时就需要重抛异常&#xff1a; 1、抛出捕获的异常 try {// statements; } catch (TheException &ex) {// Do something;throw; }2、重新抛出另一…

vi @-function

vi 的功能 vi 是一个越用越强大的东西 功能&#xff1a; 例&#xff1a; 1 在插入模式 cwgadfly CTL-V ESC 看到的似&#xff1a; cwgadfly^[ 2 保存到g缓冲区 ESC :退出插入模式 "gdd :"g 指缓冲去个 dd删除一行 这样g缓冲去的内容是 cwgadflayESC 3 test love u 在…

CSS简写指南

1.margin 1.1 margin:1px 2px 3px(上 左右 下) 1.2 margin:2px 3px(上下 左右) 1.2 margin:1px 3px 2px 3px(上右下左) 2.padding(同上) 3.border border:1px red solid (border-width border-color border-style) 1 2 3border-width&#xff1a;1px 2px 3px; //最多可用四个值…

【C++基础】模板基础与函数模板

目录初识模板函数模板函数模板实例化显式实例化隐式实例化初识模板 求两个int、float、char类型的数据的最大值&#xff1a; C里面要这样写&#xff1a; int maxInt(int x, int y); double maxDouble(double x, double y); char maxChar(char x, char y);C使用函数重载&#…

scala 函数中嵌套函数_Scala合成函数

scala 函数中嵌套函数Scala中的合成功能 (Composition function in Scala) Scala composition function is a way in which functions are composed in program i.e. mixing of more than one functions to extract some results. In Scala programming language, there are mu…

js--基础

js 0为false 非0为true null为false 非null为true js 特有with(对象){}:可以确定对象所使用的范围。for(变量 in 对象)对变量和和行为进行遍历html xhtml xml &#xff1a;这些都是标记型文档。DOM:document object model 文档对象模型。 dom三层模型&#xff1a; dom1:将…

字符串的处理[C#]

//string Str1 "友情相逢"; //string Str2 "用一生爱你"; //#region char的使用 //char a a; //Console.WriteLine("IsLetter方法判断a是否为字母&#xff1a;{0}", Char.IsLetter(a)); …

CentOS安全设置

CentOS安全设置 删除多余的用户和用户组&#xff0c;修改口令文件属性&#xff0c;禁止[CtrlAltDelete]重启命令&#xff0c;防止别人ping的方法。整理自互联网。1、删除多余的用户和用户组//删除多余用户# vi /etc/passwduserdel admuserdel lpuserdel syncuserdel shutdownus…

【设计模式之美】<Reading Notes>继承与组合

继承缺点 继承是面向对象的四大特性之一&#xff0c;用来表示类之间的 is-a 关系&#xff0c;可以解决代码复用的问题。虽然继承有诸多作用&#xff0c;但继承层次过深、过复杂&#xff0c;也会影响到代码的可维护性。在这种情况下&#xff0c;我们应该尽量少用&#xff0c;甚至…

scala中何时使用下划线_在Scala中使用下划线

scala中何时使用下划线Underscore (_) character is reserved in Scala and has multiple usages in the programming language. Based on functions that use the underscore have the following usages: 下划线(_)字符在Scala中保留&#xff0c;并且在编程语言中有多种用法。…

如何利用C#编写网页投票器程序 如何使用代理来投票 代理IP来投票

一、前言看个图&#xff0c;了解下投票的过程。提交投票信息投票页 ――――――――&#xff1e;投票信息处理页反馈投票结果(请求页)&#xff1c;―――――――(响应页&#xff09;一般情况下&#xff0c;填写投票信息&#xff0c;然后点提交按钮发送到响应页&#xff0c;这…

【设计模式之美】<Reading Notes>贫血模型与充血模型

小知识 需要了解的一些名词 1、领域驱动设计&#xff08;Domain Driven Design&#xff0c;简称 DDD&#xff09; 2、MVC 三层架构 &#xff1a; M 表示 Model&#xff0c;V 表示 View&#xff0c;C 表示 Controller。 它将整个项目分为三层&#xff1a;展示层、逻辑层、数据层…

TAFE的完整形式是什么?

TAFE&#xff1a;拖拉机和农用设备 (TAFE: Tractors and Farm Equipment) TAFE is an abbreviation of Tractors and Farm Equipment Limited. It is an Indian tractor manufacturer which is founded at Chennai in 1960. It is the second-largest tractor manufacturer in …

Oracle 10g 数据库的备份和还原

一、备份数据库1.在图形工具中&#xff0c;如sqldeveloper,pl/sqldeveloper用以下这句查找空表select alter table ||table_name|| allocate extent; from user_tables where num_rows0;2.把第一步执行得到的结果当用sql语来再次执行3.到oracle服务器上执行备份语句. 运行-cmd …

用户行为分析指导电商精细化运营

规模和利润&#xff0c;这两个在商业运营中最基本的指标&#xff0c;却在电子商务市场中遭遇了不同的待遇。前两年&#xff0c;几乎所有的电商企业都只追求规模&#xff0c;不追求利润&#xff0c;导 致自身的运营极其粗放&#xff0c;绝大多数电商公司只有两招&#xff1a;猛打…

【C++基础】 类模板

类模板 模板是将类中某些类型变为泛型&#xff0c;从而定义一个模板。 如下&#xff1a; 类模板的语法 直接进行对比&#xff1a; 泛型化之前 泛型化之后类模板的实例化 注意&#xff1a;只要是对类模版进行实例化&#xff0c;编译器就会生成一个类&#xff01;&#xff0…

ruby 怎么抛异常_Ruby中的异常处理

ruby 怎么抛异常Ruby异常处理 (Ruby Exception Handling) Exceptions are abnormal conditions arising in the code segment at runtime in the form of objects. There are certain predefined Exception classes whereas we can create our exception known as Custom excep…

cocos2d-x游戏开发系列教程-中国象棋02-main函数和欢迎页面

之前两个博客讲述了象棋的规格和工程文件之后&#xff0c;我们继续深入的从代码开始学习cocos2dx首先从程序入口main函数开始main函数int APIENTRY _tWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPTSTR lpCmdLine,int nCmdShow) {UNREFERENCED_PARAMETER(h…

[原创]Android中的android:layout_width和android:width的区别

在android系统中&#xff0c;我们可以通过在xml资源文件中定义布局&#xff0c;一般的写法是&#xff1a; <LinearLayout xmlns:android"http://schemas.android.com/apk/res/android"android:layout_width"match_parent"android:layout_height"ma…

【C++基础】模板参数与模板继承

模板参数 默认类型参数 函数参数可以设定一个默认值&#xff0c;我们现在可以对类模板的类型参数设定一个默认类型。 指定泛型Stack的默认类型参数为 int template<typename T int> class Stack{... };当我们这样定义一个对象时&#xff1a; Stack<> stack;使…