在html5中,可以利用style屬性給傾斜的文字元素添加“font-style:normal”樣式,實現(xiàn)取消文字傾斜效果,語法為“<element style="font-style:normal">傾斜文字</element>”。
本教程操作環(huán)境:windows10系統(tǒng)、HTML5版、Dell G3電腦。
html5怎樣取消文字傾斜
在html5中,想要實現(xiàn)取消文字傾斜效果,可以利用style屬性和font-style屬性。
style屬性用于設(shè)置傾斜文字的樣式,font-style屬性用于設(shè)置傾斜字體的字體樣式。
當font-style屬性的值設(shè)置為“normal”時,傾斜的字體樣式就會被取消。
示例如下:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> </head> <body> <p>這一段應該是<i>斜體</i>樣式</p> <p>這一段設(shè)置不<i style="font-style:normal">傾斜</i>的樣式</p> </body> </html>
輸出結(jié)果:
推薦教程:《html視頻教程》