{"id":66433,"date":"2022-08-13T09:30:01","date_gmt":"2022-08-13T09:30:01","guid":{"rendered":"https:\/\/www.cryptocabaret.com\/?p=66433"},"modified":"2022-08-13T09:30:01","modified_gmt":"2022-08-13T09:30:01","slug":"level-up-your-html-document-with-css","status":"publish","type":"post","link":"https:\/\/www.cryptocabaret.com\/?p=66433","title":{"rendered":"Level up your HTML document with CSS"},"content":{"rendered":"<p><span class=\"field field--name-title field--type-string field--label-hidden\">Level up your HTML document with CSS<\/span><br \/>\n<span class=\"field field--name-uid field--type-entity-reference field--label-hidden\"><a title=\"View user profile.\" href=\"https:\/\/opensource.com\/users\/jim-hall\" class=\"username\">Jim Hall<\/a><\/span><br \/>\n<span class=\"field field--name-created field--type-created field--label-hidden\">Sat, 08\/13\/2022 &#8211; 03:00<\/span><\/p>\n<div data-drupal-selector=\"rate-node-70147\" class=\"rate-widget-thumbs-up\" title=\"Register or Login to like.\">\n<div class=\"rate-thumbs-up-btn-up vote-pending\"><a href=\"https:\/\/opensource.com\/user\/register\">Register<\/a> or <a href=\"https:\/\/opensource.com\/user\/login?current=\/rss.xml\">Login<\/a> to like<\/div>\n<div class=\"rate-score\"><a href=\"https:\/\/opensource.com\/user\/register\">Register<\/a> or <a href=\"https:\/\/opensource.com\/user\/login?current=\/rss.xml\">Login<\/a> to like<\/div>\n<\/div>\n<div class=\"clearfix text-formatted field field--name-body field--type-text-with-summary field--label-hidden field__item\">\n<p>When you write documentation, whether that&#8217;s for an open source project or a technical writing project, you should have two goals: The document should be written well, and the document should be easy to read. The first is addressed by clear writing skills and technical editing. The second can be addressed with a few simple changes to an HTML document.<\/p>\n<p>HyperText Markup Language, or HTML, is the backbone of the internet. Since the dawn of the &#8220;World Wide Web&#8221; in 1994, every web browser uses HTML to display documents and websites. And for almost as long, HTML has supported the <em>stylesheet<\/em>, a special addition to an HTML document that defines how the text should appear on the screen.<\/p>\n<p>You can write project documentation in plain HTML, and that gets the job done. However, plain HTML styling may feel a little spartan. Instead, try adding a few simple styles to an HTML document to add a little pizzazz to documentation, and make your documents clearer and easier to read.<\/p>\n<h2>Defining an HTML document<\/h2>\n<p>Let&#8217;s start with a plain HTML document and explore how to add styles to it. An empty HTML document contains the <c> definition at the top, followed by an <c><\/c> block to define the document itself. Within the <c> element, you also need to include a document header that contains metadata about the document, such as its title. The contents of the document body go inside a <c><\/c> block within the parent <c><\/c> block.<\/c><\/c><\/p>\n<p>You can define a blank page with this HTML code:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"html5 geshifilter-html5\"><span class=\"sc0\"><br><span class=\"sc2\"><span class=\"kw2\">html<\/span>&gt;<\/span><br>\n\u00a0 <span class=\"sc2\"><span class=\"kw2\">head<\/span>&gt;<\/span><br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">title<\/span>&gt;<\/span>This is a new document<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/title.html\"><span class=\"kw2\">title<\/span><\/a>&gt;<\/span><br>\n\u00a0 <span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/head.html\"><span class=\"kw2\">head<\/span><\/a>&gt;<br>\n\u00a0 <span class=\"sc2\"><span class=\"kw2\">body<\/span>&gt;<\/span><br><br>\n\u00a0 <span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/body.html\"><span class=\"kw2\">body<\/span><\/a>&gt;<br><span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/html.html\"><span class=\"kw2\">html<\/span><\/a>&gt;<\/div><\/div><\/pre>\n<p>In another article about <a href=\"https:\/\/opensource.com\/article\/22\/8\/writing-project-documentation-html\" target=\"_blank\" rel=\"noopener\">Writing project documentation in HTML<\/a>, I updated a Readme file from an open source board game from plain text to an HTML document, using a few basic HTML tags like <c><\/p>\n<h1><\/h1>\n<p><\/c> and <c><\/p>\n<h2><\/h2>\n<p><\/c> for heading and subheadings, <c><\/p>\n<p><\/c> for paragraphs, and <c><b><\/b><\/c> and <c><i><\/i><\/c> for bold and italic text. Let&#8217;s pick up where we left off with that article:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"html5 geshifilter-html5\"><span class=\"sc0\"><br><span class=\"sc2\"><span class=\"kw2\">html<\/span>&gt;<\/span><br>\n\u00a0 <span class=\"sc2\"><span class=\"kw2\">head<\/span>&gt;<\/span><br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">title<\/span>&gt;<\/span>Simple Senet<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/title.html\"><span class=\"kw2\">title<\/span><\/a>&gt;<\/span><br>\n\u00a0 <span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/head.html\"><span class=\"kw2\">head<\/span><\/a>&gt;<br>\n\u00a0 <span class=\"sc2\"><span class=\"kw2\">body<\/span>&gt;<\/span><br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">h1<\/span>&gt;<\/span>Simple Senet<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/h1.html\"><span class=\"kw2\">h1<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">h2<\/span>&gt;<\/span>How to Play<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/h2.html\"><span class=\"kw2\">h2<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">p<\/span>&gt;<\/span>The game will automatically \"throw\" the throwing sticks<br>\n\u00a0 \u00a0 for you, and display the results in the lower-right corner<br>\n\u00a0 \u00a0 of the screen.<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">p<\/span>&gt;<\/span>If the \"throw\" is zero, then you lose your turn.<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">p<\/span>&gt;<\/span>When it's your turn, the game will automatically select<br>\n\u00a0 \u00a0 your first piece on the board. You may or may not be<br>\n\u00a0 \u00a0 able to make a move with this piece, so select your piece<br>\n\u00a0 \u00a0 to move, and hit <span class=\"sc2\"><span class=\"kw2\">i<\/span>&gt;<\/span>Space<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/i.html\"><span class=\"kw2\">i<\/span><\/a>&gt; (or <span class=\"sc2\"><span class=\"kw2\">i<\/span>&gt;<\/span>Enter<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/i.html\"><span class=\"kw2\">i<\/span><\/a>&gt;) to move<br>\n\u00a0 \u00a0 it. You can select using several different methods:<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">ul<\/span>&gt;<\/span><br>\n\u00a0 \u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">li<\/span>&gt;<span class=\"kw2\">i<\/span>&gt;<\/span>Up<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/i.html\"><span class=\"kw2\">i<\/span><\/a>&gt;\/<span class=\"sc2\"><span class=\"kw2\">i<\/span>&gt;<\/span>down<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/i.html\"><span class=\"kw2\">i<\/span><\/a>&gt;\/<span class=\"sc2\"><span class=\"kw2\">i<\/span>&gt;<\/span>left<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/i.html\"><span class=\"kw2\">i<\/span><\/a>&gt;\/<span class=\"sc2\"><span class=\"kw2\">i<\/span>&gt;<\/span>right<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/i.html\"><span class=\"kw2\">i<\/span><\/a>&gt; to<br>\n\u00a0 \u00a0 \u00a0 navigate to a specific square.<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/li.html\"><span class=\"kw2\">li<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <br>\n\u00a0 \u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">li<\/span>&gt;<\/span>Plus (<span class=\"sc2\"><span class=\"kw2\">b<\/span>&gt;<\/span>+<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/b.html\"><span class=\"kw2\">b<\/span><\/a>&gt;) or minus (<span class=\"sc2\"><span class=\"kw2\">b<\/span>&gt;<\/span>-<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/b.html\"><span class=\"kw2\">b<\/span><\/a>&gt;) to navigate \"left\"<br>\n\u00a0 \u00a0 \u00a0 and \"right\" on the board. Note that this will automatically<br>\n\u00a0 \u00a0 \u00a0 follow the \"backwards S\" shape of the board.<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/li.html\"><span class=\"kw2\">li<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <br>\n\u00a0 \u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">li<\/span>&gt;<span class=\"kw2\">em<\/span>&gt;<\/span>Tab<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/em.html\"><span class=\"kw2\">em<\/span><\/a>&gt; to select your next piece on the<br>\n\u00a0 \u00a0 \u00a0 board.<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/li.html\"><span class=\"kw2\">li<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/ul.html\"><span class=\"kw2\">ul<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">p<\/span>&gt;<\/span>To quit the game at any time, press <span class=\"sc2\"><span class=\"kw2\">b<\/span>&gt;<\/span>Q<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/b.html\"><span class=\"kw2\">b<\/span><\/a>&gt; (uppercase<br>\n\u00a0 \u00a0 Q) or hit <span class=\"sc2\"><span class=\"kw2\">i<\/span>&gt;<\/span>Esc<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/i.html\"><span class=\"kw2\">i<\/span><\/a>&gt;, and the game will prompt if you want<br>\n\u00a0 \u00a0 to forfeit the game.<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">p<\/span>&gt;<\/span>You win if you move all of your pieces off the board<br>\n\u00a0 \u00a0 before your opponent. It takes a combination of luck and<br>\n\u00a0 \u00a0 strategy!<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br>\n\u00a0 <span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/body.html\"><span class=\"kw2\">body<\/span><\/a>&gt;<br><span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/html.html\"><span class=\"kw2\">html<\/span><\/a>&gt;<\/div><\/div><\/pre>\n<p>This HTML document demonstrates a few common block and inline elements used by technical writers who write with HTML. Block elements define a rectangle around text. Paragraphs and headings are examples of block elements, because they extend from the left to the right edges of the document. For example, <c><\/p>\n<p><\/c> encloses an invisible rectangle around a paragraph. In contrast, inline elements follow the text where they are used. If you use <c><b><\/b><\/c> on some text within a paragraph, only the text surrounded by <c><b><\/b><\/c> and <c><\/c> becomes bold.<\/p>\n<p>You can apply direct styling to this document to change the font, colors, and other text styles, but a more efficient way to modify the document&#8217;s appearance is to apply a <em>stylesheet<\/em> to the document itself. You can do that in the <c><\/c> element, with other metadata. You can reference a file for the style sheet, but for this example, use a <c><\/c> block to define a style sheet within the document. Here&#8217;s the <c><\/c> with an empty stylesheet:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"html5 geshifilter-html5\"><span class=\"sc0\"><br><span class=\"sc2\"><span class=\"kw2\">html<\/span>&gt;<\/span><br>\n\u00a0 <span class=\"sc2\"><span class=\"kw2\">head<\/span>&gt;<\/span><br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">title<\/span>&gt;<\/span>Simple Senet<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/title.html\"><span class=\"kw2\">title<\/span><\/a>&gt;<\/span><br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">style<\/span>&gt;<\/span><br><br>\n\u00a0 \u00a0 <span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/style.html\"><span class=\"kw2\">style<\/span><\/a>&gt;<br>\n\u00a0 <span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/head.html\"><span class=\"kw2\">head<\/span><\/a>&gt;<br>\n\u00a0 <span class=\"sc2\"><span class=\"kw2\">body<\/span>&gt;<\/span><br>\n\u00a0 \u00a0 ...<br>\n\u00a0 <span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/body.html\"><span class=\"kw2\">body<\/span><\/a>&gt;<br><span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/html.html\"><span class=\"kw2\">html<\/span><\/a>&gt;<\/div><\/div><\/pre>\n<h2>Defining styles<\/h2>\n<p>Since you&#8217;re just starting to learn about stylesheets, let&#8217;s demonstrate a basic style: background color. I like to start with the background color because it helps to demonstrate block and inline elements. Let&#8217;s apply a somewhat gaudy stylesheet that sets a <em>light blue<\/em> background color for all <c><\/p>\n<p><\/c> paragraphs, and a <em>light green<\/em> background for the <c><\/p>\n<ul><\/ul>\n<p><\/c> unordered list. Use a <em>yellow<\/em> background for any bold text, and a <em>pink<\/em> background for any italics text.<\/p>\n<p>You define these using styles in the <c><\/c> block of our HTML document. The stylesheet uses a different markup than an HTML document. The style syntax looks like <code>element { style; style; style; ... }<\/code> and uses curly braces to group together several text styles into a single definition.<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"html5 geshifilter-html5\">\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">style<\/span>&gt;<\/span><br>\np { background-color: lightblue; }<br>\nul { background-color: lightgreen; }<br><br>\nb { background-color: yellow; }<br>\ni { background-color: pink; }<br>\n\u00a0 \u00a0 <span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/style.html\"><span class=\"kw2\">style<\/span><\/a>&gt;<\/div><\/div><\/pre>\n<p>Note that each style ends with a semicolon.<\/p>\n<p>If you view this HTML document in a web browser, you can see how the <c><\/p>\n<p><\/c> and <c><\/p>\n<ul><\/ul>\n<p><\/c> block elements are filled in as rectangles, and the <c><b><\/b><\/c> and <c><i><\/i><\/c> inline elements highlight only the bold and italics text. This use of contrasting colors may not be pretty to look at, but I think you can see the block and inline elements:<\/p>\n<article class=\"align-center media media--type-image media--view-mode-default\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/08\/style-html-1.png\" width=\"960\" height=\"662\" alt=\"My eyes! But the colors do help us see block and inline elements.\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>(Jim Hall, CC BY-SA 4.0)<\/p>\n<\/div>\n<\/article>\n<div class=\"embedded-resource-list callout-float-right\">\n<div class=\"field field--name-title field--type-string field--label-hidden field__item\">More Linux resources<\/div>\n<div class=\"field field--name-links field--type-link field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/developers.redhat.com\/cheat-sheets\/linux-commands-cheat-sheet\/?intcmp=70160000000h1jYAAQ\">Linux commands cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/developers.redhat.com\/cheat-sheets\/advanced-linux-commands\/?intcmp=70160000000h1jYAAQ\">Advanced Linux commands cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/www.redhat.com\/en\/services\/training\/rh024-red-hat-linux-technical-overview?intcmp=70160000000h1jYAAQ\">Free online course: RHEL technical overview<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/cheat-sheet-networking?intcmp=70160000000h1jYAAQ\">Linux networking cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/cheat-sheet-selinux?intcmp=70160000000h1jYAAQ\">SELinux cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/downloads\/linux-common-commands-cheat-sheet?intcmp=70160000000h1jYAAQ\">Linux common commands cheat sheet<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/resources\/what-are-linux-containers?intcmp=70160000000h1jYAAQ\">What are Linux containers?<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/linux?intcmp=70160000000h1jYAAQ\">Our latest Linux articles<\/a><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<h2>Applying styles<\/h2>\n<p>You can use styles to make this Readme document easier to read. You&#8217;re just starting to learn about styles, you&#8217;ll stick to a few simple style elements:<\/p>\n<ul>\n<li>background-color to set the background color<\/li>\n<li>color to set the text color<\/li>\n<li>font-family to use a different text font<\/li>\n<li>margin-top to add space above an element<\/li>\n<li>margin-bottom to add space below an element<\/li>\n<li>text-align to change how the text is displayed, such as to the left, to the right, or centered<\/li>\n<\/ul>\n<p>Let&#8217;s start over with your stylesheet and apply these new styles to your document. To begin, use a more pleasing font for your document. If your HTML document does not specify a font, the web browser picks one for you. Depending on how the browser is set up, this could be a <em>serif<\/em> font, like the font used in my screenshot, or a <em>sans-serif<\/em> font. Serif fonts have a small stroke added to each letter, which makes these fonts much easier to read in print. Sans-serif fonts lack this extra stroke, which makes text appear sharper on a computer display. Common serif fonts include Garamond or Times New Roman. Popular sans-serif fonts include Roboto and Arial.<\/p>\n<p>For example, to set the document body font to Roboto, use this style:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"html5 geshifilter-html5\">body { font-family: Roboto; }<\/code><\/span><\/pre>\n<p>By setting a font, you assume the person viewing your document also has that font installed. Some fonts have become so common they are considered de facto &#8220;Web safe&#8221; fonts. These include sans-serif fonts like Arial and serif fonts such as Times New Roman. Roboto is a newer font and may not be available everywhere. So instead of listing just one font, web designers usually put one or more &#8220;backup&#8221; fonts. You can add these alternative fonts by separating them with a comma. For example, if the user doesn&#8217;t have the Roboto font on their system, you can instead use Arial for the text body by using this style definition:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"html5 geshifilter-html5\">body { font-family: Roboto, Arial; }<\/code><\/span><\/pre>\n<p>All web browsers define a default serif and sans-serif font that you can reference with those names. Users can change which font they prefer to use for serif and sans-serif, so aren&#8217;t likely to be the same for everyone, but using serif or sans-serif in a font list is usually a good idea. By adding that font, at least the user gets some approximation of how you want the HTML document to appear:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"html5 geshifilter-html5\">body { font-family: Roboto, Arial, sans-serif; }<\/code><\/span><\/pre>\n<p>If your font name is more than one word, you have to put quotes around it. HTML allows you to use either single quotes or double quotes here. Define a few serif fonts for the heading and subheading, including Times New Roman:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"html5 geshifilter-html5\">h1 { font-family: \"Times New Roman\", Garamond, serif; }<br>\nh2 { font-family: \"Times New Roman\", Garamond, serif; }<\/div><\/div><\/pre>\n<p>Note that the <c>h1<\/c> heading and <c>h2<\/c> subheading use exactly the same font definition. If you want to avoid the extra typing, you can use a stylesheet shortcut to use the same style definition for both <c>h1<\/c> and <c>h2<\/c>:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"html5 geshifilter-html5\">h1, h2 { font-family: \"Times New Roman\", Garamond, serif; }<\/code><\/span><\/pre>\n<p>When writing documentation, many technical writers prefer to center the main title on the page. You can use <c>text-align<\/c> on a block element, such as the <c>h1<\/c> heading, to center just the title:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"html5 geshifilter-html5\">h1 { text-align: center; }<\/code><\/span><\/pre>\n<p>To help bold and italics text to stand out, put them in a slightly different color. For certain documents, I might use <em>dark blue<\/em> for bold text, and <em>dark green<\/em> for italics text. These are pretty close to black, but with just enough subtle difference that the color grabs the reader&#8217;s attention.<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"html5 geshifilter-html5\">b { color: darkblue; }<br>\ni { color: darkgreen; }<\/div><\/div><\/pre>\n<p>Finally, I prefer to add extra spacing around my list elements, to make these easier to read. If each list item was only a few words, the extra space might not matter. But the middle item \u00a0in my example text is quite long and wraps to a second line. The extra space helps the reader see each item in this list more clearly. You can use the <c>margin<\/c> style to add space above and below a block element:<\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"html5 geshifilter-html5\">li { margin-top: 10px; margin-bottom: 10px; }<\/code><\/span><\/pre>\n<p>This style defines a distance, which I&#8217;ve indicated here as <c>10px<\/c> (ten <em>pixels<\/em>) above and below each list element. You can use several different measures for distance. Ten pixels is literally the space of ten pixels on your screen, whether that&#8217;s a desktop monitor, a laptop display, or a phone or tablet screen.<\/p>\n<p>Assuming you really just want to add an extra blank line between the list elements, you can also use <c>em<\/c> for my measurement. An <em>em<\/em> is an old typesetting term that is exactly the width of capital <strong>M<\/strong> if you refer to left and right spacing, or the height of a capital <strong>M<\/strong> for vertical spacing. So you can instead write the margin style using <c>1em:<\/c><\/p>\n<pre>\n<span class=\"geshifilter\"><code class=\"html5 geshifilter-html5\">li { margin-top: 1em; margin-bottom: 1em; } <\/code><\/span><\/pre>\n<p>The complete list of styles in your HTML document looks like this:<\/p>\n<pre>\n<div class=\"geshifilter\"><div class=\"html5 geshifilter-html5\"><span class=\"sc0\"><br><span class=\"sc2\"><span class=\"kw2\">html<\/span>&gt;<\/span><br>\n\u00a0 <span class=\"sc2\"><span class=\"kw2\">head<\/span>&gt;<\/span><br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">title<\/span>&gt;<\/span>Simple Senet<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/title.html\"><span class=\"kw2\">title<\/span><\/a>&gt;<\/span><br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">style<\/span>&gt;<\/span><br>\nbody { font-family: Roboto, Arial, sans-serif; }<br>\nh1, h2 { font-family: \"Times New Roman\", Garamond, serif; }<br>\nh1 { text-align: center; }<br>\nb { color: darkblue; }<br>\ni { color: darkgreen; }<br>\nli { margin-top: 1em; margin-bottom: 1em; }<br>\n\u00a0 \u00a0 <span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/style.html\"><span class=\"kw2\">style<\/span><\/a>&gt;<br>\n\u00a0 <span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/head.html\"><span class=\"kw2\">head<\/span><\/a>&gt;<br>\n\u00a0 <span class=\"sc2\"><span class=\"kw2\">body<\/span>&gt;<\/span><br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">h1<\/span>&gt;<\/span>Simple Senet<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/h1.html\"><span class=\"kw2\">h1<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">h2<\/span>&gt;<\/span>How to Play<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/h2.html\"><span class=\"kw2\">h2<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">p<\/span>&gt;<\/span>The game will automatically \"throw\" the throwing sticks<br>\n\u00a0 \u00a0 for you, and display the results in the lower-right corner<br>\n\u00a0 \u00a0 of the screen.<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">p<\/span>&gt;<\/span>If the \"throw\" is zero, then you lose your turn.<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">p<\/span>&gt;<\/span>When it's your turn, the game will automatically select<br>\n\u00a0 \u00a0 your first piece on the board. You may or may not be<br>\n\u00a0 \u00a0 able to make a move with this piece, so select your piece<br>\n\u00a0 \u00a0 to move, and hit <span class=\"sc2\"><span class=\"kw2\">i<\/span>&gt;<\/span>Space<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/i.html\"><span class=\"kw2\">i<\/span><\/a>&gt; (or <span class=\"sc2\"><span class=\"kw2\">i<\/span>&gt;<\/span>Enter<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/i.html\"><span class=\"kw2\">i<\/span><\/a>&gt;) to move<br>\n\u00a0 \u00a0 it. You can select using several different methods:<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">ul<\/span>&gt;<\/span><br>\n\u00a0 \u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">li<\/span>&gt;<span class=\"kw2\">i<\/span>&gt;<\/span>Up<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/i.html\"><span class=\"kw2\">i<\/span><\/a>&gt;\/<span class=\"sc2\"><span class=\"kw2\">i<\/span>&gt;<\/span>down<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/i.html\"><span class=\"kw2\">i<\/span><\/a>&gt;\/<span class=\"sc2\"><span class=\"kw2\">i<\/span>&gt;<\/span>left<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/i.html\"><span class=\"kw2\">i<\/span><\/a>&gt;\/<span class=\"sc2\"><span class=\"kw2\">i<\/span>&gt;<\/span>right<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/i.html\"><span class=\"kw2\">i<\/span><\/a>&gt; to<br>\n\u00a0 \u00a0 \u00a0 navigate to a specific square.<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/li.html\"><span class=\"kw2\">li<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <br>\n\u00a0 \u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">li<\/span>&gt;<\/span>Plus (<span class=\"sc2\"><span class=\"kw2\">b<\/span>&gt;<\/span>+<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/b.html\"><span class=\"kw2\">b<\/span><\/a>&gt;) or minus (<span class=\"sc2\"><span class=\"kw2\">b<\/span>&gt;<\/span>-<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/b.html\"><span class=\"kw2\">b<\/span><\/a>&gt;) to navigate \"left\"<br>\n\u00a0 \u00a0 \u00a0 and \"right\" on the board. Note that this will automatically<br>\n\u00a0 \u00a0 \u00a0 follow the \"backwards S\" shape of the board.<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/li.html\"><span class=\"kw2\">li<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <br>\n\u00a0 \u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">li<\/span>&gt;<span class=\"kw2\">em<\/span>&gt;<\/span>Tab<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/em.html\"><span class=\"kw2\">em<\/span><\/a>&gt; to select your next piece on the<br>\n\u00a0 \u00a0 \u00a0 board.<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/li.html\"><span class=\"kw2\">li<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/ul.html\"><span class=\"kw2\">ul<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">p<\/span>&gt;<\/span>To quit the game at any time, press <span class=\"sc2\"><span class=\"kw2\">b<\/span>&gt;<\/span>Q<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/b.html\"><span class=\"kw2\">b<\/span><\/a>&gt; (uppercase<br>\n\u00a0 \u00a0 Q) or hit <span class=\"sc2\"><span class=\"kw2\">i<\/span>&gt;<\/span>Esc<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/i.html\"><span class=\"kw2\">i<\/span><\/a>&gt;, and the game will prompt if you want<br>\n\u00a0 \u00a0 to forfeit the game.<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br>\n\u00a0 \u00a0 <br>\n\u00a0 \u00a0 <span class=\"sc2\"><span class=\"kw2\">p<\/span>&gt;<\/span>You win if you move all of your pieces off the board<br>\n\u00a0 \u00a0 before your opponent. It takes a combination of luck and<br>\n\u00a0 \u00a0 strategy!<span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/p.html\"><span class=\"kw2\">p<\/span><\/a>&gt;<br>\n\u00a0 <span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/body.html\"><span class=\"kw2\">body<\/span><\/a>&gt;<br><span class=\"sc2\">\/<\/span><a href=\"http:\/\/december.com\/html\/4\/element\/html.html\"><span class=\"kw2\">html<\/span><\/a>&gt;<\/div><\/div><\/pre>\n<p>When viewed on a web browser, you see your Readme document in a sans-serif font, with serif fonts for the heading and subheading. The page title is centered. The bold and italics text use a slightly different color that calls the reader&#8217;s attention without being distracting. Finally, your list items have extra space around them, making each item easier to read.<\/p>\n<article class=\"align-center media media--type-image media--view-mode-default\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/08\/style-html-2.png\" width=\"960\" height=\"627\" alt=\"By adding a few styles, we've made this Readme much easier to read.\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>(Jim Hall, CC BY-SA 4.0)<\/p>\n<\/div>\n<\/article>\n<p>This is a simple introduction to using styles in technical writing. Having mastered the basics, you might be interested in <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/HTML\" target=\"_blank\" rel=\"noopener\">Mozilla&#8217;s HTML Guide<\/a>. This includes some great beginner&#8217;s tutorials so you can learn how to create your own web pages.<\/p>\n<p>For more information on how CSS styling works, I recommend <a href=\"https:\/\/developer.mozilla.org\/en-US\/docs\/Web\/CSS\" target=\"_blank\" rel=\"noopener\">Mozilla&#8217;s CSS Guide<\/a>.<\/p>\n<\/div>\n<div class=\"clearfix text-formatted field field--name-field-article-subhead field--type-text-long field--label-hidden field__item\">\n<p>Use CSS to bring style to your HTML project documentation.<\/p>\n<\/div>\n<div class=\"field field--name-field-lead-image field--type-entity-reference field--label-hidden field__item\">\n<article class=\"media media--type-image media--view-mode-caption\">\n<div class=\"field field--name-field-media-image field--type-image field--label-hidden field__item\">  <img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/08\/painting_computer_screen_art_design_creative.png\" width=\"1040\" height=\"585\" alt=\"Painting art on a computer screen\" title=\"Painting art on a computer screen\"><\/div>\n<div class=\"field field--name-field-caption field--type-text-long field--label-hidden caption field__item\"><span class=\"caption__byline\">Image by: <\/span><\/p>\n<p>Opensource.com<\/p>\n<\/div>\n<\/article>\n<\/div>\n<div class=\"field field--name-field-tags field--type-entity-reference field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/documentation\" hreflang=\"en\">Documentation<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/tags\/linux\" hreflang=\"en\">Linux<\/a><\/div>\n<\/p><\/div>\n<div class=\"field field--name-field-listicle-title field--type-string field--label-hidden field__item\">Read more from this technical writing series<\/div>\n<div class=\"field field--name-field-listicles field--type-entity-reference field--label-hidden field__items\">\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/article\/22\/7\/fmt-trivial-text-formatter\" hreflang=\"en\">How I use the Linux fmt command to format text<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/article\/22\/8\/automate-file-edits-sed-linux\" hreflang=\"en\">How I use the Linux sed command to automate file edits<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/article\/22\/8\/old-school-technical-writing-groff\" hreflang=\"en\">Old-school technical writing with groff<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/article\/22\/8\/pdf-latex\" hreflang=\"en\">Create beautiful PDFs in LaTeX<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/article\/22\/8\/gentle-introduction-html\" hreflang=\"en\">A gentle introduction to HTML<\/a><\/div>\n<div class=\"field__item\"><a href=\"https:\/\/opensource.com\/article\/22\/8\/writing-project-documentation-html\" hreflang=\"en\">Writing project documentation in HTML<\/a><\/div>\n<\/p><\/div>\n<div class=\"field field--name-field-default-license field--type-list-string field--label-hidden field__item\"><a rel=\"license\" href=\"http:\/\/creativecommons.org\/licenses\/by-sa\/4.0\/\"><br \/>\n        <img decoding=\"async\" alt=\"Creative Commons License\" src=\"https:\/\/www.cryptocabaret.com\/wp-content\/uploads\/2022\/08\/cc-by-sa--19.png\" title=\"This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.\"><\/a>This work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.<\/div>\n<section class=\"field field--name-field-comments field--type-comment field--label-hidden comment-wrapper\">\n<div class=\"comments__count\">\n<div class=\"login\"><a href=\"https:\/\/opensource.com\/user\/register?absolute=1\">Register<\/a> or <a href=\"https:\/\/opensource.com\/user\/login?current=\/rss.xml&amp;absolute=1\">Login<\/a> to post a comment.<\/div>\n<\/p><\/div>\n<\/section>\n<p class=\"wpematico_credit\"><small>Powered by <a href=\"http:\/\/www.wpematico.com\" target=\"_blank\" rel=\"noopener\">WPeMatico<\/a><\/small><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Level up your HTML document with CSS Jim Hall Sat, 08\/13\/2022 &#8211; 03:00 Register or Login to like Register or Login to like When you write documentation, whether that&#8217;s for an open source project or a technical writing project, you should have two goals: The document should be written well, and the document should be [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":66434,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[307],"tags":[],"class_list":["post-66433","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-open-source"],"_links":{"self":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/66433","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=66433"}],"version-history":[{"count":0,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/posts\/66433\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=\/wp\/v2\/media\/66434"}],"wp:attachment":[{"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=66433"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=66433"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cryptocabaret.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=66433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}