{"id":4299,"date":"2017-10-09T21:34:40","date_gmt":"2017-10-09T21:34:40","guid":{"rendered":"http:\/\/www.crimsondesigns.com\/blog\/?p=4299"},"modified":"2023-12-23T14:24:21","modified_gmt":"2023-12-23T14:24:21","slug":"wordpress-beginner-html-css","status":"publish","type":"post","link":"https:\/\/www.crimsondesigns.com\/blog\/wordpress-beginner-html-css\/","title":{"rendered":"WordPress under the Hood: Beginner HTML &#038; CSS"},"content":{"rendered":"<h2>PART 1: HTML in WordPress<\/h2>\n<p>Do you have a little experience with WordPress? But now you want to dig a little deeper and get a look under the hood? Let\u2019s take a step beyond simply publishing a page, uploading images and installing plugins.<\/p>\n<p>In this beginner tutorial, we&#8217;ll focus on HTML and CSS. In related tutorials, we&#8217;ll peek at <a href=\"http:\/\/www.crimsondesigns.com\/blog\/wordpress-beginner-php-javascript\/\">PHP &amp; JavaScript<\/a> and also <a href=\"http:\/\/www.crimsondesigns.com\/blog\/wordpress-files-folders-templates\/\">Files, Folders &amp; Templates.<\/a><\/p>\n<p><!--more--><\/p>\n<p><strong>Do you need to know HTML and CSS to use WordPress?<\/strong><\/p>\n<p>No. But the more you know, the better off you\u2019ll be at managing your WordPress website (self-hosted version). We won\u2019t dig too deep, just enough to get a little dirty.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright\" src=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2017\/10\/white-screen-of-death-wordpress.gif\" alt=\"white screen of death - WordPress\" width=\"300\" height=\"402\">As you probably already know, WordPress has an admin side (dashboard) for creating and editing content, and a front end that your site visitors see.<\/p>\n<p>You can create a <strong>WordPress website<\/strong> without knowing how to code by selecting a theme, publishing pages, creating a custom menu and adding pages to that menu.<\/p>\n<p>But sooner or later, you&#8217;ll want to tweak your site or solve a problem.<\/p>\n<p>You have to understand the files and code just enough to pull this off. By going under the hood, you\u2019ll take a giant leap forward and be better prepared if you\u2019re ever confronted with the dreaded <strong>\u201c<a href=\"http:\/\/www.wpexplorer.com\/fixes-wordpress-white-screen\/\" target=\"_blank\" rel=\"noopener noreferrer\">white screen of death.<\/a>\u201d<\/strong><\/p>\n<p><strong>Ready? Let\u2019s start digging.<\/strong><\/p>\n<p>You may not know that WordPress is built upon mainly three languages, <strong>PHP,<\/strong> <strong>CSS<\/strong> and <strong>HTML.<\/strong> <strong>JavaScript<\/strong> is gaining increasing importance too.<\/p>\n<p><strong>Why learn HTML when you can already publish <a href=\"https:\/\/onehappystudio.com\/wordpress-post\/\" target=\"_blank\" rel=\"noopener noreferrer\">posts<\/a> and pages?&nbsp;<\/strong>Learning basic HTML (along with CSS) will help you gain greater control over the look of your individual posts and pages.<\/p>\n<h2>What is HTML?<\/h2>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-4493\" src=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2017\/09\/html-css-frame.gif\" alt=\"HTML CSS frame\" width=\"236\" height=\"197\"><\/p>\n<p>HTML is the main language used to create web pages. It&#8217;s all about organizing and controlling how your website content is displayed. Its purpose is to apply meaning, not presentation. Using HTML elements, you can define content as paragraphs, headings, lists, links, images etc..<\/p>\n<h3>How to View HTML in WordPress<\/h3>\n<p>You may already be familiar with HTML if you\u2019ve written a WordPress post and switched to your Code editor in your WordPress Gutenberg editor.<\/p>\n<p>(FYI: The WordPress Gutenberg editor for posts and pages can be found when you go to&nbsp;<strong>Admin &gt; Posts &gt; Add New<\/strong>&nbsp;or&nbsp;<strong>Admin &gt; Pages &gt; Add New<\/strong>.)<\/p>\n<p>Go to your WordPress admin section (dashboard) and edit a post or page you\u2019ve written.&nbsp;<\/p>\n<div class=\"co8aDb gsrt\" role=\"heading\" aria-level=\"3\"><b>How to Access Gutenberg Code Editor<\/b><\/div>\n<div class=\"RqBzHd\">\n<ol class=\"X5LH0c\">\n<li class=\"TrT0Xe\"><b>Open the<\/b> post\/page&nbsp;<b>editor<\/b>.<\/li>\n<li class=\"TrT0Xe\">Look to the right in the top navbar.<\/li>\n<li class=\"TrT0Xe\">Click the <strong>three dots<\/strong>. You&#8217;ll see &#8220;<strong>More tools &amp; options<\/strong>.&#8221;<\/li>\n<li class=\"TrT0Xe\">In the drop-down panel, click <b>Code editor<\/b>.<\/li>\n<\/ol>\n<\/div>\n<p>Do you see a lot of <strong>angle brackets &lt; &gt;<\/strong>?&nbsp;You\u2019re looking at HTML.<\/p>\n<h3>How to recognize HTML (syntax)<\/h3>\n<p>HTML is all about elements and tags. HTML elements are the building blocks of HTML pages. An HTML element generally consists of a start tag, content and an end tag.<\/p>\n<ul>\n<li>HTML tags normally come in<strong> pairs<\/strong> like <strong>&lt;p&gt;<\/strong> and <strong>&lt;\/p&gt;.<\/strong><\/li>\n<li>The first tag in a pair is the <strong>start tag. <\/strong>The second one is the <strong>end tag.<\/strong><\/li>\n<li>The end tag has angle brackets like the start tag, but also has a&nbsp;<strong>forward slash<\/strong> inserted before the tag name.<\/li>\n<\/ul>\n<div class=\"codeWrap\">\n<p><strong>&lt;h1&gt;<\/strong>This is a Heading<strong>&lt;\/h1&gt;<\/strong><\/p>\n<p><strong>&lt;a href=&#8221;<a href=\"https:\/\/www.crimsondesigns.com\">https:\/\/www.crimsondesigns.com<\/a>&#8220;&gt;<\/strong> This is a link.<strong>&lt;\/a&gt;<\/strong><\/p>\n<\/div>\n<ul>\n<li>The <strong>&lt;h1&gt;<\/strong> element is used to define a large heading.<\/li>\n<li>The <strong>&lt;a&gt;<\/strong> element defines a link.<\/li>\n<li>The <strong>&lt;img&gt;<\/strong> element defines an image. (It doesn\u2019t come in a pair. There is no end tag.)<\/li>\n<\/ul>\n<p>In a web page (<a href=\"https:\/\/www.computerhope.com\/issues\/ch000746.htm\" target=\"_blank\" rel=\"noopener noreferrer\"><u>source code<\/u><\/a>), you may notice that <strong>&lt;html&gt;<\/strong>&nbsp;is the&nbsp;<strong>opening tag.<\/strong> It&nbsp;starts things off and tells the browser that everything between that and the&nbsp;<strong>&lt;\/html&gt;<\/strong>&nbsp;<strong>closing tag<\/strong>&nbsp;is an HTML document.<\/p>\n<p>The content between&nbsp;<strong>&lt;body&gt;<\/strong>&nbsp;and&nbsp;<strong>&lt;\/body&gt;<\/strong>&nbsp;is the main content that will appear in the web browser screen.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"centered\" src=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2017\/10\/html-on-computer.jpg\" alt=\"HTML on computer\" width=\"503\" height=\"332\"><\/p>\n<h4>To learn the nitty-gritty details of HTML, read: <a href=\"http:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-html-to-html5\/\">Smooth Strides from HTML to HTML5<\/a>.<\/h4>\n<h3>Web Browsers and HTML<\/h3>\n<p>Keep in mind, web browsers (ex. Chrome, Firefox) do not display HTML tags, but use them to determine how to display the document. Web browsers read HTML documents and display them on a screen.<\/p>\n<p><strong>Did you know?<\/strong><\/p>\n<p>Did you know that if you work strictly in your WordPress VISUAL Editor (Gutenberg), you\u2019re still adding HTML to your post? It is just taking place &#8220;<strong>under the hood<\/strong>&#8221;&nbsp;where you can\u2019t see it.<\/p>\n<p>Once you make the move to the Code editor, you will be taking your first step towards better WordPress management and you\u2019ll gain some HTML skills. Of course, you can switch back and forth between the Visual editor and the Code editor.<\/p>\n<h3>Go ahead and practice.<\/h3>\n<p>Add a new post, write something in the Gutenberg Visual editor, make something bold (strong) and then take a peek at the Code editor to see the HTML. Keep the post as a draft and try to make some changes in the Code editor. Have some fun with it!<\/p>\n<p>In your Code editor, you\u2019ll likely see <strong>&lt;h1&gt;<\/strong> tags, <strong>&lt;a&gt;<\/strong> tags, <strong>&lt;img&gt;<\/strong> tags and <strong>&lt;strong&gt;<\/strong> tags.<\/p>\n<h3>&nbsp;CODE\/ VISUAL Editors in a Nutshell<\/h3>\n<p>Basically, the Code editor&nbsp;shows&nbsp;you the HTML markup. The Visual editor does its best to&nbsp;interpret&nbsp;that HTML markup and present it to you similar to the way it will look in a web browser.&nbsp;By switching to the Code editor, you can add your own <strong>custom styling<\/strong> to your content.&nbsp;<\/p>\n<h4>You\u2019re off to a great start now. Let\u2019s move on to CSS.<\/h4>\n<ul class=\"table-of-paginated-contents\">\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/wordpress-beginner-html-css\/\">PART 1: HTML in WordPress<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/wordpress-beginner-html-css\/2\/\">PART 2: CSS in WordPress<\/a><\/li>\n<\/ul>\n<p><!--nextpage--><\/p>\n<h2>PART 2: CSS in WordPress<\/h2>\n<h3>Why should I learn CSS when I have Gutenberg?<\/h3>\n<ul>\n<li>Understanding a little bit about CSS will help you spot inline CSS in your Code editor while writing a post\/page.&nbsp;<\/li>\n<li>The day will come when you want even more control over the look and feel of your website.<\/li>\n<\/ul>\n<p><strong>There are 3 Types of CSS Styles:<\/strong><\/p>\n<ul>\n<li>Inline<\/li>\n<li>Embedded<\/li>\n<li>External Stylesheets<\/li>\n<\/ul>\n<h3>Inline CSS<\/h3>\n<p>You are adding inline CSS to your post\/page when you add a <strong>\u201ccolor\u201d<\/strong> to an element in your VISUAL editor. It\u2019s taking place <strong>&#8220;under the hood.&#8221;<\/strong><\/p>\n<h4>How to Recognize Inline CSS<\/h4>\n<div class=\"codeWrap\">\n<p><strong>&lt;h2 style=&#8221;color:red;&#8221;&gt;<\/strong>Header Example<strong>&lt;\/h2&gt;<\/strong><\/p>\n<\/div>\n<p>TIP: Look for the <strong><span style=\"color: #993300;\">\u201cstyle=\u201d<\/span><\/strong> as a sign you\u2019re looking at inline CSS.<\/p>\n<p>Remember that inline CSS is applied locally to an element. The style above is only applied to one h2&nbsp;element and makes it <strong>\u201cred.\u201d<\/strong> It is best used is for a specific post\/page you\u2019re working on.&nbsp;<\/p>\n<h3>External Style Sheets<\/h3>\n<p>NOTE: Every WordPress website includes at least one theme. Every theme includes at least one external style sheet.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-4555\" src=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2017\/10\/wordpress-icon.png\" alt=\"WordPress icon\" width=\"161\" height=\"160\" srcset=\"https:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2017\/10\/wordpress-icon.png 161w, https:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2017\/10\/wordpress-icon-150x150.png 150w\" sizes=\"auto, (max-width: 161px) 100vw, 161px\" \/><\/p>\n<p>The main <a href=\"https:\/\/www.quackit.com\/css\/external_style_sheets.cfm\" target=\"_blank\" rel=\"noopener noreferrer\">external style sheet<\/a> in your WordPress theme is probably called <strong>style.css.<\/strong><\/p>\n<p>Before you can make changes, you need to be able to read a style sheet and understand the syntax first. Once you find your theme&#8217;s main style sheet and can make sense of it, you can add your own styles, but there&#8217;s a catch. Instead of making changes to that specific style sheet, you&#8217;re better off creating a <a href=\"https:\/\/themegrill.com\/blog\/tutorial-creating-wordpress-child-theme\/\"><u>child theme<\/u><\/a> with its own main style sheet. You&#8217;ll call it <strong>style.css<\/strong>. (same name as the style sheet in the main (parent) theme that you were studying.<\/p>\n<p>You will then add custom CSS to it, which will override the styles in your parent theme. You will not only need to understand a bit of CSS, you will also need to know the basics of file structure and how to find, recognize and create CSS files.<\/p>\n<p>For now, let\u2019s learn a bit about CSS, so we can recognize it when we see it.<\/p>\n<p><strong>That\u2019s the first step.<\/strong> Recognize it.<\/p>\n<p>Then be able to read it. Practice. Then write your own CSS.<\/p>\n<h2>What is CSS?<\/h2>\n<p>CSS (Cascading Style Sheets) is a style sheet language used to define visual appearance of HTML documents. It dictates your website\u2019s look and feel and will hopefully make it beautiful &#8211; with your help.<\/p>\n<ul>\n<li>CSS is simple to use and easy to learn.<\/li>\n<li>HTML elements can be styled directly with CSS.<\/li>\n<li>Font size, font color, font type, page layout etc. are determined by CSS.<\/li>\n<\/ul>\n<p>To learn more about the differences between&nbsp;Inline,&nbsp;Embedded and&nbsp;External Stylesheets, read: <a href=\"https:\/\/www.thoughtco.com\/types-of-css-styles-3466921\" target=\"_blank\" rel=\"noopener noreferrer\">3 Types of CSS Styles: Inline, Embedded, and External Stylesheets.&nbsp;<\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"centered\" src=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2017\/10\/cascading-style-sheets.jpg\" alt=\"cascading style sheets\" width=\"500\" height=\"239\"><\/p>\n<h3><em>Recognizing CSS (Syntax) in an External Style Sheet<\/em><\/h3>\n<ul>\n<li><strong><span style=\"color: #800000;\">Example:<\/span> h1 &nbsp;{color:&nbsp;white; text-align:&nbsp;center;}<br><\/strong>(This heading will be white and center-aligned.)<\/li>\n<\/ul>\n<p>The example above is called a CSS rule-set. It starts with a selector (h1) followed by a declaration block.&nbsp;<\/p>\n<h4><strong>\u201cCurly braces\u201d<\/strong> surround declaration blocks. They are important!<\/h4>\n<p><strong>TIP:<\/strong> Look for the curly braces as a sign you may be looking at CSS in a style sheet.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"centered\" src=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2017\/10\/css-on-computer.jpg\" alt=\"css on computer\" width=\"503\" height=\"332\"><\/p>\n<h4>Learn the nitty gritty details about CSS: <a href=\"http:\/\/www.crimsondesigns.com\/blog\/smooth-strides-from-css-to-css3\/\">Smooth Strides from CSS to CSS3<\/a><\/h4>\n<h3>A Closer Look at Child Themes<\/h3>\n<p>Child themes inherit <strong>CSS styles<\/strong> of the original theme (parent theme). You can add your own styles. Thankfully, if you make a mistake in your child theme, you can deactivate it and revert back to your parent theme while you fix your mistake. You can then reactivate your child theme. It&#8217;s a nice safety net!<\/p>\n<p><strong>Remember:<\/strong> Don\u2019t edit the stylesheet in a (parent) theme. You will have no safety net. Also, if it is updated, your changes will be lost.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"centered\" src=\"https:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2017\/10\/wordpress-child-theme.gif\" alt=\"WordPress Child Theme\" width=\"525\" height=\"305\"><\/p>\n<p>By learning to write CSS, you can move beyond customizing the posts and pages on your website to modifying your chosen WordPress theme. Your website will become more uniquely yours and it just might give you enough confidence to go deeper under the hood to explore <a href=\"https:\/\/www.crimsondesigns.com\/blog\/wordpress-beginner-php-javascript\/\">PHP<\/a> and JavaScript.<\/p>\n<ul class=\"table-of-paginated-contents\">\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/wordpress-beginner-html-css\/\">PART 1: HTML in WordPress<\/a><\/li>\n<li><a href=\"https:\/\/www.crimsondesigns.com\/blog\/wordpress-beginner-html-css\/2\/\">PART 2: CSS in WordPress<\/a><\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"centered\" src=\"http:\/\/www.crimsondesigns.com\/blog\/wp-content\/uploads\/2017\/10\/css-in-wordpress.gif\" alt=\"CSS in WordPress\" width=\"600\" height=\"368\"><\/p>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Do you need to know HTML and CSS to use WordPress? No. But the more you know, the better off you&#8217;ll be at managing your WordPress website (self-hosted version). We won&#8217;t dig too deep, just enough to get a little dirty.<\/p>\n","protected":false},"author":1,"featured_media":7548,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,10],"tags":[285,286,279,284],"class_list":{"0":"post-4299","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-html-and-css","8":"category-wordpress","9":"tag-html-elements","10":"tag-html-tags","11":"tag-wordpress-beginner","12":"tag-wordpress-child-theme","13":"cat-5-id","14":"cat-10-id","15":"has_thumb"},"_links":{"self":[{"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/posts\/4299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/comments?post=4299"}],"version-history":[{"count":5,"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/posts\/4299\/revisions"}],"predecessor-version":[{"id":7733,"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/posts\/4299\/revisions\/7733"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/media\/7548"}],"wp:attachment":[{"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/media?parent=4299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/categories?post=4299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.crimsondesigns.com\/blog\/wp-json\/wp\/v2\/tags?post=4299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}