

{"id":112706,"date":"2023-03-15T09:00:52","date_gmt":"2023-03-15T03:30:52","guid":{"rendered":"https:\/\/data-flair.training\/blogs\/?p=112706"},"modified":"2024-07-29T12:17:29","modified_gmt":"2024-07-29T06:47:29","slug":"css-fonts-and-font-family","status":"publish","type":"post","link":"https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/","title":{"rendered":"CSS Fonts and Font Family"},"content":{"rendered":"<p>CSS (Cascading Style Sheets) is a styling language which is used to represent the presentation of a document which is written in a markup language, such as HTML.One of the main features of CSS is the ability to change the font used to display text on a web page. CSS provides a wide range of options for controlling font properties, such as family, size, weight, and style. Additionally, CSS allows for the use of web fonts, which are fonts that are not installed on the user&#8217;s device but are instead downloaded and used by the browser.<\/p>\n<h3>Properties of CSS Fonts<\/h3>\n<p>There are several properties in CSS that can be used to control the font used in a web page. Here is a list of some of the most used properties<\/p>\n<p><strong>1. font-family:<\/strong> This property sets the font family for an element.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;style&gt;\r\np {\r\n  font-family: Arial, sans-serif;\r\n}\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;p&gt;This text is written in Arial font.&lt;\/p&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/font-weight.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-112762\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/font-weight.webp\" alt=\"font weight\" width=\"1712\" height=\"733\" \/><\/a><\/p>\n<p><strong>2. font-size:<\/strong> This property sets the size of the font<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;style&gt;\r\np {\r\n  font-size: 20px;\r\n}\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;p&gt;This text is 20px in size&lt;\/p&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/font-family.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-112763\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/font-family.webp\" alt=\"font family\" width=\"1411\" height=\"688\" \/><\/a><\/p>\n<p><strong>3. font-weight:<\/strong> This property sets the boldness of the font.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;style&gt;\r\np {\r\n  font-weight: bold;\r\n}\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;p&gt;DataFlair written in bold&lt;\/p&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/font-style.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-112764\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/font-style.webp\" alt=\"font style\" width=\"1375\" height=\"690\" \/><\/a><\/p>\n<p><strong>4. font-style:<\/strong> This property sets style of Font<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;style&gt;\r\np {\r\n  font-style: italic;\r\n}\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;p&gt;DataFlair written in italic&lt;\/p&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p><a href=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/line-height.webp\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-112765\" src=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/line-height.webp\" alt=\"line height\" width=\"1147\" height=\"667\" \/><\/a><\/p>\n<p><strong>5. line-height:<\/strong> This property sets the space between lines of text.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;style&gt;\r\np {\r\n  line-height: 2;\r\n}\r\n&lt;\/style&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n\r\n&lt;p&gt;This text containing DataFlair has line height of 2.&lt;\/p&gt;\r\n\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>#IMAGE#<\/p>\n<h3>Some other features of CSS Font<\/h3>\n<p><strong>1. text-align:<\/strong> This property aligns the text within an element. It can be set to values such as left, right, center or justify.<\/p>\n<p><strong>2. letter-spacing:<\/strong> This property controls the space between characters in a text.<\/p>\n<p><strong>3. word-spacing:<\/strong> This property controls the space between words in a text.<\/p>\n<p><strong>4. text-decoration:<\/strong> This property adds decoration to text. It can be set to values such as underline, overline, line-through, and blink.<\/p>\n<p><strong>5. text-transform:<\/strong> This property controls the text capitalization. It can be set to values such as uppercase, lowercase, capitalize, and none.<\/p>\n<p><strong>6. color:<\/strong> This property sets the color of the text. It can be set using color keywords, hexadecimal values, or RGB values.<\/p>\n<p><strong>7. text-shadow:<\/strong> This property adds a shadow effect to the text.<\/p>\n<p><strong>8. text-overflow:<\/strong> This property controls the text-overflow behavior. It can be set to values such as clip, ellipsis or string.<\/p>\n<p><strong>9. text-wrap:<\/strong> This property controls how text wraps in an element.<\/p>\n<p><strong>10. text-justify:<\/strong> This property controls the justification of text within an element.<\/p>\n<p><strong>11. text-indent :<\/strong> This property sets the indentation of the first line of text in an element.<\/p>\n<p>These are the features of CSS font, it allows one to control the font family, size, weight, style, spacing, alignment, decoration, and many more aspects of text on a web page.<\/p>\n<p>All these properties give the developer a set of tools to work with the text, so it fits the general layout of the webpage in terms of appearance. By properly applying these properties, one will be able to make text content attractive with reasonable accessibility and therefore make a difference for the users of the web-site.<\/p>\n<h3>CSS Font Family<\/h3>\n<p>In typography, a font family is a group of related typefaces that share similar design characteristics. These characteristics can include things like stroke width, letter spacing, and overall style.<\/p>\n<p>Within a font family, there can be several different styles or variations of the typeface. These variations are often referred to as fonts or typefaces, but technically they are different styles within a font family. For example, the font family &#8220;Times&#8221; might include the styles &#8220;Times New Roman&#8221;, &#8220;Times Bold&#8221;, and &#8220;Times Italic&#8221;.<\/p>\n<p>There are many different font families, each with its own unique style and characteristics.<\/p>\n<p>Here are some examples of popular font families and their associated styles:<\/p>\n<p><strong>1. Serif Fonts:<\/strong> Serif fonts are characterized by the small lines or strokes that extend from the ends of the letters. Examples of serif font families include Times, Georgia, and Baskerville.<\/p>\n<p><strong>2. Sans-Serif Fonts:<\/strong> Sans-serif fonts do not have the small lines or strokes at the ends of the letters. They tend to be more modern and minimalist in style. Examples of sans-serif font families include Arial, Helvetica, and Verdana.<\/p>\n<p><strong>3. Script Fonts:<\/strong> Script fonts are designed to look like handwriting or calligraphy. They tend to have flowing lines and decorative flourishes. Examples of script font families include Brush Script, Zapfino, and Lucida Calligraphy.<\/p>\n<p><strong>4. Display Fonts:<\/strong> Display fonts are designed to be used at larger sizes, such as for headlines or titles. They tend to be more decorative and eye-catching. Examples of display font families include Impact, Cooper Black, and Broadway.<\/p>\n<p><strong>5. Monospace Fonts:<\/strong> Monospace fonts are designed so that each letter takes up the same amount of space. They are often used for programming or other applications where it is important to line up columns of text. Examples of monospace font families include Courier and Consolas.<\/p>\n<p>These are just a few examples of the many font families and styles that exist. When choosing a font for a design project, it&#8217;s important to consider the overall style and tone of the project, as well as readability and legibility. Selecting the right font can greatly influence how the content is perceived by users, making it crucial for designers to understand the implications of their font choices.<\/p>\n<h3>Conclusion<\/h3>\n<p>In conclusion, CSS fonts allow for a wide range of customization options for text on a web page. From the font family and size to spacing and alignment, CSS provides a variety of properties and values that can be used to create a unique and visually appealing design. By understanding the different features of CSS fonts, developers and designers can create an engaging and user-friendly experience for their website visitors.<\/p>\n<p>Additionally, with the latest CSS3 properties, web designers can apply advanced typography and effects to their text, which can make the web pages more interactive and engaging. Overall, CSS fonts are an essential aspect of website design, and a deep understanding of its properties and features is crucial for creating a successful and visually appealing website.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CSS (Cascading Style Sheets) is a styling language which is used to represent the presentation of a document which is written in a markup language, such as HTML.One of the main features of CSS&#46;&#46;&#46;<\/p>\n","protected":false},"author":581,"featured_media":112751,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27226],"tags":[27321,27320],"class_list":["post-112706","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-css-tutorials","tag-css-font-family","tag-css-fonts"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>CSS Fonts and Font Family - DataFlair<\/title>\n<meta name=\"description\" content=\"CSS fonts allow for a wide range of customization options for text on a web page. See its properties and font family.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"CSS Fonts and Font Family - DataFlair\" \/>\n<meta property=\"og:description\" content=\"CSS fonts allow for a wide range of customization options for text on a web page. See its properties and font family.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/\" \/>\n<meta property=\"og:site_name\" content=\"DataFlair\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/DataFlairWS\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-03-15T03:30:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-07-29T06:47:29+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/CSS-font.webp\" \/>\n\t<meta property=\"og:image:width\" content=\"1200\" \/>\n\t<meta property=\"og:image:height\" content=\"628\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/webp\" \/>\n<meta name=\"author\" content=\"DataFlair Team\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:site\" content=\"@DataFlairWS\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"DataFlair Team\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"CSS Fonts and Font Family - DataFlair","description":"CSS fonts allow for a wide range of customization options for text on a web page. See its properties and font family.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/","og_locale":"en_US","og_type":"article","og_title":"CSS Fonts and Font Family - DataFlair","og_description":"CSS fonts allow for a wide range of customization options for text on a web page. See its properties and font family.","og_url":"https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/","og_site_name":"DataFlair","article_publisher":"https:\/\/www.facebook.com\/DataFlairWS\/","article_published_time":"2023-03-15T03:30:52+00:00","article_modified_time":"2024-07-29T06:47:29+00:00","og_image":[{"width":1200,"height":628,"url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/CSS-font.webp","type":"image\/webp"}],"author":"DataFlair Team","twitter_card":"summary_large_image","twitter_creator":"@DataFlairWS","twitter_site":"@DataFlairWS","twitter_misc":{"Written by":"DataFlair Team","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/#article","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/"},"author":{"name":"DataFlair Team","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/c187795dc82ab948373cca526df7c445"},"headline":"CSS Fonts and Font Family","datePublished":"2023-03-15T03:30:52+00:00","dateModified":"2024-07-29T06:47:29+00:00","mainEntityOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/"},"wordCount":936,"commentCount":0,"publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/CSS-font.webp","keywords":["CSS Font Family","CSS Fonts"],"articleSection":["CSS Tutorials"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/","url":"https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/","name":"CSS Fonts and Font Family - DataFlair","isPartOf":{"@id":"https:\/\/data-flair.training\/blogs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/#primaryimage"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/#primaryimage"},"thumbnailUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/CSS-font.webp","datePublished":"2023-03-15T03:30:52+00:00","dateModified":"2024-07-29T06:47:29+00:00","description":"CSS fonts allow for a wide range of customization options for text on a web page. See its properties and font family.","breadcrumb":{"@id":"https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/#primaryimage","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/CSS-font.webp","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2023\/03\/CSS-font.webp","width":1200,"height":628,"caption":"CSS font"},{"@type":"BreadcrumbList","@id":"https:\/\/data-flair.training\/blogs\/css-fonts-and-font-family\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Blog Home","item":"https:\/\/data-flair.training\/blogs\/"},{"@type":"ListItem","position":2,"name":"CSS Tutorials","item":"https:\/\/data-flair.training\/blogs\/category\/css-tutorials\/"},{"@type":"ListItem","position":3,"name":"CSS Fonts and Font Family"}]},{"@type":"WebSite","@id":"https:\/\/data-flair.training\/blogs\/#website","url":"https:\/\/data-flair.training\/blogs\/","name":"DataFlair","description":"Learn Today. Lead Tomorrow.","publisher":{"@id":"https:\/\/data-flair.training\/blogs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/data-flair.training\/blogs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/data-flair.training\/blogs\/#organization","name":"DataFlair","url":"https:\/\/data-flair.training\/blogs\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/","url":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","contentUrl":"https:\/\/data-flair.training\/blogs\/wp-content\/uploads\/sites\/2\/2016\/07\/Data-Flair.png","width":106,"height":48,"caption":"DataFlair"},"image":{"@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/DataFlairWS\/","https:\/\/x.com\/DataFlairWS","https:\/\/www.linkedin.com\/company\/dataflair-web-services-pvt-ltd\/","https:\/\/www.youtube.com\/user\/DataFlairWS"]},{"@type":"Person","@id":"https:\/\/data-flair.training\/blogs\/#\/schema\/person\/c187795dc82ab948373cca526df7c445","name":"DataFlair Team","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2302ebc438084d2f1f993edc1996a0aae01332e81f3227cba8df0c48ec010ca4?s=96&d=mm&r=g","caption":"DataFlair Team"},"description":"DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.","url":"https:\/\/data-flair.training\/blogs\/author\/dfteam6\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/112706","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/comments?post=112706"}],"version-history":[{"count":8,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/112706\/revisions"}],"predecessor-version":[{"id":143008,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/posts\/112706\/revisions\/143008"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media\/112751"}],"wp:attachment":[{"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/media?parent=112706"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/categories?post=112706"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/data-flair.training\/blogs\/wp-json\/wp\/v2\/tags?post=112706"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}