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.pswp.cn/news/377406.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/377406.shtml
英文地址,請注明出處:http://en.pswp.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;使…