search
HTML Fonts StylesSep 04, 2024 pm 04:14 PM
htmlhtml5HTML TutorialHTML PropertiesHTML tags

The following article, HTML Fonts Styles, provides an outline of the most commonly used font styles in HTML. HTML, popularly known as HyperText Markup Language, is one of the most essential and critical languages or scripts that is essential in creating web applications and websites. This is like the backbone of web app development, as all the tags and other features form the underlying component of it.

All the front-end development is also based on HTML scripting. This can just be used to provide markup tags, and in order to enhance the look and feel of these tags, we have another library that is very popular, CSS, which stands for Cascading Style Sheets. This can be used to implement all kinds of styles that are required by the HTML. The font and styles form the major part of the website, and in this article, we are going to provide you with a list of the majority of the HTML font styles.

HTML Font styles

Fonts play a major role in making a website more user-friendly and attract more traffic apart from increasing content readability. The font color and the font face also depend on the computer and the browser which is making its use, and the HTML tag is also used to add the style, color, size to the text on your website.

The tag is used to set all the text which is present on your website or inside the

element to the same size, color, and face.  The font tag consists of three attributes: face color and size, which again forms a critical component of the different font styles present inside the website.

The tag is the most commonly used and one of the most important tags which can be used to build a good look and feel for your webpage. The text which will follow the opened tag will remain in the same manner unless and until closed by tag.

Let us look at some of the basic HTML Fonts Styles:

There are some basic features and characteristics associated with HTML font styles, and they are:

1. Setting Font Size

The content font size can be set by making use of size attributes. The accepted value of the range lies from 1, which is the smallest number, and it goes till 7, which is the largest number. The default size of any font type is 3.

Example,



<title>Setting Basic Font Size</title>


<font size="1">Font size = "1"</font><br>
<font size="2">Font size = "2"</font><br>
<font size="3">Font size = "3"</font><br>
<font size="4">Font size = "4"</font><br>
<font size="5">Font size = "5"</font><br>
<font size="6">Font size = "6"</font><br>
<font size="7">Font size = "7"</font>

2. Relative Font Size

The relative font size is used to determine and specify how many sizes are larger and how many sizes are smaller than the current font size which is actually present. This can be specified like :

<font size="+f"> or by writing <font size="−f"></font></font>

Example,



<title>Relative Font Size</title>


<font size="-1">Font size = "-1"</font><br>
<font size="+1">Font size = "+1"</font><br>
<font size="+2">Font size = "+2"</font><br>
<font size="+3">Font size = "+3"</font><br>
<font size="+4">Font size = "+4"</font>

3. Setting Font Face

The other category after the setting of font size and relative font size is that of the setting up of font face. This forms a critical part of the attributes listed above. This can be set by using the face attribute, but it should always be kept in mind that if the user who is designated to use this font value doesn’t have this font installed in their system, they will not be able to see it. Instead, only the default font face applicable to that particular user’s computer will be visible.

Example,



<title>Font Face</title>


<font face="Times New Roman" size="5">Times New Roman</font><br>
<font face="Verdana" size="5">Verdana</font><br>
<font face="Comic sans MS" size=" 5">Comic Sans MS</font><br>
<font face="WildWest" size="5">WildWest</font><br face="Bedrock" size="5">Bedrock<br>

4. Specify Alternative Font Faces

  • This is used to specify various kinds of font faces only if the user has that particular font installed on their system; otherwise, a default installed font will be visible. It is possible to mention more than one, specifically two or more than two font face alternatives by listing down the font face names, which are specifically separated by a comma.
  • When the webpage gets loaded, The browser will be responsible for displaying the first-ever font, which will get generated. If none of the provided fonts is installed in the system, then the default font face, which is Times New Roman, will be displayed successfully.

Example,

<font face="arial,helvetica">
<font face="Lucida Calligraphy,Comic Sans MS,Lucida Console"></font></font>

5. Setting Font Color

This is another attribute that forms the critical part and component of the HTML font and styles list. In this font, color is set up by making use of any color attribute; the color which is required could be required by making use of hexadecimal code and color name for the specified color.

Example,



<title>Setting Font Color</title>


<font color="#FF00FF">This text is in pink</font><br>
<font color="red">This text is red</font>


<basefont>

6. Element

  • This element is specific to HTML language and is supposed to provide the webpage with a default font size, typeface, and color for all the parts and components of the documents which are not contained inside the tag.
  • The tag could be easily used to override the settings.
  • This tag also makes use of color, face and size attributes which will relatively support all the font settings by providing the size of a value of +1 for one size greater or -2 for two sizes smaller.

Example,



<title>Setting Basefont Color</title>


<basefont face="arial, verdana, sans-serif" size="2" color="#ff0000">
<p>This is the page's default font.</p>
<h2 id="Example-of-the-lt-basefont-gt-Element">Example of the <basefont> Element</h2>

Conclusion

HTML font and styles are among the most critical components and features that cannot be overlooked and can give a very good shape and design to your website. When we talk about the latest javascript libraries available in the market, they contain all these and several other font and styles. For the basic HTML, this still needs to be done manually. I hope you liked our article. Stay tuned to our blog for more articles like these.

The above is the detailed content of HTML Fonts Styles. For more information, please follow other related articles on the PHP Chinese website!

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
HTML超文本标记语言--超在那里?(文档分析)HTML超文本标记语言--超在那里?(文档分析)Aug 02, 2022 pm 06:04 PM

本篇文章带大家了解一下HTML(超文本标记语言),介绍一下HTML的本质,HTML文档的结构、HTML文档的基本标签和图像标签、列表、表格标签、媒体元素、表单,希望对大家有所帮助!

html和css算编程语言吗html和css算编程语言吗Sep 21, 2022 pm 04:09 PM

不算。html是一种用来告知浏览器如何组织页面的标记语言,而CSS是一种用来表现HTML或XML等文件样式的样式设计语言;html和css不具备很强的逻辑性和流程控制功能,缺乏灵活性,且html和css不能按照人类的设计对一件工作进行重复的循环,直至得到让人类满意的答案。

web前端笔试题库之HTML篇web前端笔试题库之HTML篇Apr 21, 2022 am 11:56 AM

总结了一些web前端面试(笔试)题分享给大家,本篇文章就先给大家分享HTML部分的笔试题(附答案),大家可以自己做做,看看能答对几个!

总结HTML中a标签的使用方法及跳转方式总结HTML中a标签的使用方法及跳转方式Aug 05, 2022 am 09:18 AM

本文给大家总结介绍a标签使用方法和跳转方式,希望对大家有所帮助!

HTML5中画布标签是什么HTML5中画布标签是什么May 18, 2022 pm 04:55 PM

HTML5中画布标签是“<canvas>”。canvas标签用于图形的绘制,它只是一个矩形的图形容器,绘制图形必须通过脚本(通常是JavaScript)来完成;开发者可利用多种js方法来在canvas中绘制路径、盒、圆、字符以及添加图像等。

html中document是什么html中document是什么Jun 17, 2022 pm 04:18 PM

在html中,document是文档对象的意思,代表浏览器窗口的文档;document对象是window对象的子对象,所以可通过“window.document”属性对其进行访问,每个载入浏览器的HTML文档都会成为Document对象。

html5废弃了哪个列表标签html5废弃了哪个列表标签Jun 01, 2022 pm 06:32 PM

html5废弃了dir列表标签。dir标签被用来定义目录列表,一般和li标签配合使用,在dir标签对中通过li标签来设置列表项,语法“<dir><li>列表项值</li>...</dir>”。HTML5已经不支持dir,可使用ul标签取代。

Html5怎么取消td边框Html5怎么取消td边框May 18, 2022 pm 06:57 PM

3种取消方法:1、给td元素添加“border:none”无边框样式即可,语法“td{border:none}”。2、给td元素添加“border:0”样式,语法“td{border:0;}”,将td边框的宽度设置为0即可。3、给td元素添加“border:transparent”样式,语法“td{border:transparent;}”,将td边框的颜色设置为透明即可。

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment