{"id":1045,"date":"2023-05-22T12:04:24","date_gmt":"2023-05-22T03:04:24","guid":{"rendered":"http:\/\/2ruja.com\/~game03\/?p=1045"},"modified":"2023-05-22T12:09:02","modified_gmt":"2023-05-22T03:09:02","slug":"using-css","status":"publish","type":"post","link":"https:\/\/2ruja.com\/~game03\/wp\/?p=1045","title":{"rendered":"Using CSS"},"content":{"rendered":"\n<p>CSS can be added to HTML documents in 3 ways:<\/p>\n\n\n\n<ul>\n<li><strong>Inline<\/strong>\u00a0&#8211; by using the\u00a0<code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">style<\/mark><\/code>\u00a0attribute inside HTML elements<\/li>\n\n\n\n<li><strong>Internal<\/strong>\u00a0&#8211; by using a<mark style=\"background-color:rgba(0, 0, 0, 0);color:#cf2c2c\" class=\"has-inline-color\">\u00a0<code>&lt;style><\/code><\/mark><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\u00a0<\/mark>element in the\u00a0<code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&lt;head><\/mark><\/code>\u00a0section<\/li>\n\n\n\n<li><strong>External<\/strong>\u00a0&#8211; by using a\u00a0<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\"><code>&lt;link><\/code>\u00a0<\/mark>element to link to an external CSS file\n<ul><\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p>The most common way to add CSS, is to keep the styles in external CSS files. However, in this tutorial we will use inline and internal styles, because this is easier to demonstrate, and easier for you to try it yourself.<\/p>\n\n\n\n<h2>Inline CSS<\/h2>\n\n\n\n<p>An inline CSS is used to apply a unique style to a single HTML element.<\/p>\n\n\n\n<p>An inline CSS uses the\u00a0<code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">style<\/mark><\/code>\u00a0attribute of an HTML element.<\/p>\n\n\n\n<p>The following example sets the text color of the\u00a0<code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&lt;h1><\/mark><\/code>\u00a0element to blue, and the text color of the\u00a0<code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&lt;p><\/mark><\/code>\u00a0element to red:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;h1 style=\"color:blue;\">A Blue Heading&lt;\/h1>\n\n&lt;p style=\"color:red;\">A red paragraph.&lt;\/p><\/pre>\n\n\n\n<h2>Internal CSS<\/h2>\n\n\n\n<p>An internal CSS is used to define a style for a single HTML page.<\/p>\n\n\n\n<p>An internal CSS is defined in the\u00a0<code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&lt;head><\/mark><\/code>\u00a0section of an HTML page, within a\u00a0<code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&lt;style><\/mark><\/code>\u00a0element.<\/p>\n\n\n\n<p>The following example sets the text color of ALL the\u00a0<code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&lt;h1><\/mark><\/code>\u00a0elements (on that page) to blue, and the text color of ALL the\u00a0<code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">&lt;p><\/mark><\/code>\u00a0elements to red. In addition, the page will be displayed with a &#8220;powderblue&#8221; background color:\u00a0<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;!DOCTYPE html>\n&lt;html>\n&lt;head>\n&lt;style>\nbody {background-color: powderblue;}\nh1   {color: blue;}\np    {color: red;}\n&lt;\/style>\n&lt;\/head>\n&lt;body>\n\n&lt;h1>This is a heading&lt;\/h1>\n&lt;p>This is a paragraph.&lt;\/p>\n\n&lt;\/body>\n&lt;\/html><\/pre>\n\n\n\n<h2>External CSS<\/h2>\n\n\n\n<p>An external style sheet is used to define the style for many HTML pages.<\/p>\n\n\n\n<p>To use an external style sheet, add a link to it in the<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">\u00a0<code>&lt;head><\/code><\/mark>\u00a0section of each HTML page:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">&lt;!DOCTYPE html>\n&lt;html>\n&lt;head>\n  &lt;link rel=\"stylesheet\" href=\"styles.css\">\n&lt;\/head>\n&lt;body>\n\n&lt;h1>This is a heading&lt;\/h1>\n&lt;p>This is a paragraph.&lt;\/p>\n\n&lt;\/body>\n&lt;\/html><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>CSS can be added to HTML documents in 3 ways: The most common way to add CSS, is to keep the styles in external CSS files. However, in this tutorial we will use inline and internal styles, because this is easier to demonstrate, and easier for you to try it yourself. Inline CSS An inline [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[41],"tags":[],"_links":{"self":[{"href":"https:\/\/2ruja.com\/~game03\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1045"}],"collection":[{"href":"https:\/\/2ruja.com\/~game03\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/2ruja.com\/~game03\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/2ruja.com\/~game03\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/2ruja.com\/~game03\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1045"}],"version-history":[{"count":5,"href":"https:\/\/2ruja.com\/~game03\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1045\/revisions"}],"predecessor-version":[{"id":1050,"href":"https:\/\/2ruja.com\/~game03\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1045\/revisions\/1050"}],"wp:attachment":[{"href":"https:\/\/2ruja.com\/~game03\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1045"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/2ruja.com\/~game03\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1045"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/2ruja.com\/~game03\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1045"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}