{"id":928,"date":"2023-03-15T17:11:01","date_gmt":"2023-03-15T17:11:01","guid":{"rendered":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/?page_id=928"},"modified":"2023-03-23T08:25:33","modified_gmt":"2023-03-23T08:25:33","slug":"css-text","status":"publish","type":"page","link":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/authoring-a-website\/week-2\/css-text\/","title":{"rendered":"CSS Text"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Font family<\/h2>\n\n\n\n<p>The font-family tag allows us to choose the font used to show the text. These fonts must exist on a user\u2019s computer to work so you should usually limit your choice to the common fonts that are used on all computers. The font family tag allows you to list multiple fonts separated by commas. The browser will try from left to right to find the listed font. If the font name contains spaces, then enclose it in quotes.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.p1 {\n  font-family: \"Times New Roman\", Times, serif;\n}\n.p2 {\n  font-family: Arial, Helvetica, sans-serif;\n}\n\n&lt;p class=\"p1\"&gt;This is a paragraph with font-family: \"Times New Roman\", Times, serif;&lt;\/p&gt;\n&lt;p class=\"p2\"&gt;This is a paragraph with font-family: Arial, Helvetica, sans-serif;&lt;\/p&gt;\n&lt;p&gt;This is a normal paragraph&lt;\/p&gt;<\/code><\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"594\" height=\"180\" src=\"https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/03\/15171029\/HTML19.png\" alt=\"Example font family\" class=\"wp-image-929\" srcset=\"https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/03\/15171029\/HTML19.png 594w, https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/03\/15171029\/HTML19-300x91.png 300w\" sizes=\"auto, (max-width: 594px) 100vw, 594px\" \/><figcaption>Example font family<\/figcaption><\/figure><\/div>\n\n\n\n<hr class=\"wp-block-separator\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">Font size<\/h2>\n\n\n\n<p>As the name implies, the font-size property changes the size of the text. Sizes can be set using pixel or point sizes: px, pt. But should use relative sizes such as rem, em or a percentage of the parent size so that they behave more responsively on different screens. 1em equals 16 px by default in most browsers.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>body {\n  font-size: 100%;\n}\n\nh1 {\n   font-size: 2.5em;\n}\n\nh2 {\n  font-size: 1.875em;\n}<\/code><\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"570\" height=\"263\" src=\"https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/03\/15171340\/HTML21.png\" alt=\"Example font size\" class=\"wp-image-934\" srcset=\"https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/03\/15171340\/HTML21.png 570w, https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/03\/15171340\/HTML21-300x138.png 300w\" sizes=\"auto, (max-width: 570px) 100vw, 570px\" \/><figcaption>Example font size<\/figcaption><\/figure><\/div>\n\n\n\n<hr class=\"wp-block-separator\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">Font weight<\/h2>\n\n\n\n<p>The font-weight property changes how thick a character appears. Not all fonts will support all the options. The main options are:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>normal<\/li><li>bold<\/li><li>bolder<\/li><li>lighter<\/li><li>100, 200, 300, 400, 500, 600, 700, 800, 900 (400 is normal, 700 is bold)<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>p.normal {\n  font-weight: normal;\n}\n\np.thick {\n  font-weight: bold;\n}<\/code><\/pre>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"163\" src=\"https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/03\/15171448\/HTML23-1024x163-1.png\" alt=\"Example font weights\" class=\"wp-image-937\" srcset=\"https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/03\/15171448\/HTML23-1024x163-1.png 1024w, https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/03\/15171448\/HTML23-1024x163-1-300x48.png 300w, https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/03\/15171448\/HTML23-1024x163-1-768x122.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Example font weights<\/figcaption><\/figure><\/div>\n\n\n\n<hr class=\"wp-block-separator\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">Text decoration<\/h2>\n\n\n\n<p>The text-decoration tag allows you to change any decoration on a text such as underlines. The common options are:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>none -remove any decoration<\/li><li>overline \u2013 a line over the text<\/li><li>underline \u2013 a line under the text, links have this by default<\/li><li>line-through \u2013 a line through the centre of the text as if crossed out<\/li><\/ul>\n\n\n\n<p>Removing the underline from links in a menu is a common design method.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"960\" height=\"232\" src=\"https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/03\/15171719\/HTML29.png\" alt=\"Example text decoration\" class=\"wp-image-941\" srcset=\"https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/03\/15171719\/HTML29.png 960w, https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/03\/15171719\/HTML29-300x73.png 300w, https:\/\/blogs.glowscotland.org.uk\/es\/public\/software\/uploads\/sites\/4063\/2023\/03\/15171719\/HTML29-768x186.png 768w\" sizes=\"auto, (max-width: 960px) 100vw, 960px\" \/><figcaption>Example text decoration<\/figcaption><\/figure><\/div>\n\n\n\n<hr class=\"wp-block-separator\" \/>\n\n\n\n<h2 class=\"wp-block-heading\">List styles<\/h2>\n\n\n\n<p>To change how a list looks you can use the following rules:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ul {\n  list-style-type: square;\n}<\/code><\/pre>\n\n\n\n<p>The default value is disc, but you could use square, circle, upper-roman, lower-roman for example to change how it looks, or none to hide the bullet point.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ul.a {\n  list-style-position: inside;\n}<\/code><\/pre>\n\n\n\n<p>The default is outside, the bullet points are in the area used for padding. Changing it to inside makes the list look more indented as the bullet points are now inside the content area.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ul {\n  list-style-image: url(\"tick.png\");\n}<\/code><\/pre>\n\n\n\n<p>Just like with a background image you put the path to the image file in the brackets.<\/p>\n\n\n\n<p>Or just list-style as a shortcut to change multiple values in one line.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ul {\n  list-style: square inside url(\"tick.png\");\n}<\/code><\/pre>\n\n\n\n<p class=\"nextlink\"><a href=\"https:\/\/blogs.glowscotland.org.uk\/es\/software\/authoring-a-website\/week-2\/css-flex-and-grid\/\" data-type=\"page\" data-id=\"947\">Next: CSS Flex and grid<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Font family The font-family tag allows us to choose the font used to show the text. These fonts must exist on a user\u2019s computer to work so you should usually limit your choice to the common fonts that are used on all computers. The font family tag allows you to list multiple fonts separated by&hellip; <a class=\"more-link\" href=\"https:\/\/blogs.glowscotland.org.uk\/es\/software\/authoring-a-website\/week-2\/css-text\/\">Continue reading <span class=\"screen-reader-text\">CSS Text<\/span><\/a><\/p>\n","protected":false},"author":5710,"featured_media":0,"parent":56,"menu_order":3,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-928","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/pages\/928","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/users\/5710"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/comments?post=928"}],"version-history":[{"count":8,"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/pages\/928\/revisions"}],"predecessor-version":[{"id":950,"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/pages\/928\/revisions\/950"}],"up":[{"embeddable":true,"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/pages\/56"}],"wp:attachment":[{"href":"https:\/\/blogs.glowscotland.org.uk\/es\/software\/wp-json\/wp\/v2\/media?parent=928"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}