{"id":124,"date":"2018-04-23T18:52:31","date_gmt":"2018-04-23T18:52:31","guid":{"rendered":"https:\/\/ucsbwebdev.fzilla.com\/?p=124"},"modified":"2018-04-23T18:52:31","modified_gmt":"2018-04-23T18:52:31","slug":"styling-css-introduction","status":"publish","type":"post","link":"https:\/\/ucsbwebdev.fzilla.com\/?p=124","title":{"rendered":"Styling (CSS) Introduction"},"content":{"rendered":"<h2>Adding styles to your page<\/h2>\n<p>To add CSS (Cascading Style Sheet) to your website you need to add a\u00a0\u00a0<code class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">&lt;style&gt; &lt;\/style&gt;<\/code>\u00a0tag which will hold the unique CSS markup.<\/p>\n<p>In our exercise app there is a special panel to enter your styles which automatically adds the style tag for you.<\/p>\n<h2>CSS Syntax Intro<\/h2>\n<p>To add CSS properly you must follow this syntax<\/p>\n<p id=\"jNbDhjr\"><img loading=\"lazy\" decoding=\"async\" width=\"1298\" height=\"380\" class=\"alignnone size-full wp-image-126 \" src=\"https:\/\/ucsbwebdev.fzilla.com\/wp-content\/uploads\/2018\/04\/img_5ade29685fd0e.png\" alt=\"\" srcset=\"https:\/\/ucsbwebdev.fzilla.com\/wp-content\/uploads\/2018\/04\/img_5ade29685fd0e.png 1298w, https:\/\/ucsbwebdev.fzilla.com\/wp-content\/uploads\/2018\/04\/img_5ade29685fd0e-300x88.png 300w, https:\/\/ucsbwebdev.fzilla.com\/wp-content\/uploads\/2018\/04\/img_5ade29685fd0e-768x225.png 768w, https:\/\/ucsbwebdev.fzilla.com\/wp-content\/uploads\/2018\/04\/img_5ade29685fd0e-1024x300.png 1024w, https:\/\/ucsbwebdev.fzilla.com\/wp-content\/uploads\/2018\/04\/img_5ade29685fd0e-1200x351.png 1200w\" sizes=\"auto, (max-width: 1298px) 100vw, 1298px\" \/><\/p>\n<p>First, we have a selector, this tells the CSS which element we want to add the styling to. There are three ways to select an element:<\/p>\n<ol>\n<li>You can use its class with the\u00a0<strong>.\u00a0<\/strong>selector So if you have an element like<br \/>\n<code class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">&lt;div class=\"hello\"&gt; Hi &lt;\/div&gt;<\/code>\u00a0 you would use the following CSS code to make it have a black background\u00a0\u00a0<code class=\"EnlighterJSRAW\" data-enlighter-language=\"css\">.hello { background: black; }<\/code><\/li>\n<li>By using the id with the\u00a0<strong>#\u00a0<\/strong>selector<\/li>\n<li>By using the element&#8217;s name (ideally only used for anchor or img) where first we select the parent element then add a space and list the element, for example:\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"html\">&lt;div class=\"button\"&gt;\r\n    &lt;a href=\"#\"&gt;Welcome&lt;\/a&gt;\r\n&lt;\/div&gt;<\/pre>\n<p>We would use the following CSS to make the anchor have green text color<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"css\">.button a {\r\n   color: green;\r\n}<\/pre>\n<p>The space indicates an element inside the selected element.<\/p>\n<p>The proper syntax to specify each style declaration (each thing you&#8217;re changing) looks like this:<\/li>\n<\/ol>\n<div style=\"direction: ltr; border-width: 100%;\">\n<div style=\"direction: ltr; margin-top: 0in; margin-left: 0in; width: 13.0541in;\">\n<div style=\"direction: ltr; margin-top: 0in; margin-left: 0in; width: 13.0541in;\">\n<p id=\"DLQUSPp\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-125\" src=\"https:\/\/ucsbwebdev.fzilla.com\/wp-content\/uploads\/2018\/04\/img_5ade2779c2dc3.png\" alt=\"\" width=\"600\" height=\"313\" srcset=\"https:\/\/ucsbwebdev.fzilla.com\/wp-content\/uploads\/2018\/04\/img_5ade2779c2dc3.png 940w, https:\/\/ucsbwebdev.fzilla.com\/wp-content\/uploads\/2018\/04\/img_5ade2779c2dc3-300x157.png 300w, https:\/\/ucsbwebdev.fzilla.com\/wp-content\/uploads\/2018\/04\/img_5ade2779c2dc3-768x401.png 768w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/p>\n<\/div>\n<\/div>\n<\/div>\n<p>We enter the property like <strong>background\u00a0<\/strong>then we enter a colon separator so we can define the value we want to set like\u00a0<strong>red\u00a0<\/strong>and we\u00a0<strong>must end the declaration with a semi-colon ;<\/strong><\/p>\n<p>Here is sample code with two declarations:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"css\">.button a {\r\n    color: green;\r\n    background: black;\r\n}<\/pre>\n<p>You can find a nice list of <a href=\"https:\/\/ucsbwebdev.fzilla.com\/cssproperties.html\">CSS properties you can use here<\/a>.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Adding styles to your page To add CSS (Cascading Style Sheet) to your website you need to add a\u00a0\u00a0&lt;style&gt; &lt;\/style&gt;\u00a0tag which will hold the unique CSS markup. In our exercise app there is a special panel to enter your styles which automatically adds the style tag for you. CSS Syntax Intro To add CSS properly [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-124","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/ucsbwebdev.fzilla.com\/index.php?rest_route=\/wp\/v2\/posts\/124","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ucsbwebdev.fzilla.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ucsbwebdev.fzilla.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ucsbwebdev.fzilla.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ucsbwebdev.fzilla.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=124"}],"version-history":[{"count":1,"href":"https:\/\/ucsbwebdev.fzilla.com\/index.php?rest_route=\/wp\/v2\/posts\/124\/revisions"}],"predecessor-version":[{"id":127,"href":"https:\/\/ucsbwebdev.fzilla.com\/index.php?rest_route=\/wp\/v2\/posts\/124\/revisions\/127"}],"wp:attachment":[{"href":"https:\/\/ucsbwebdev.fzilla.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=124"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ucsbwebdev.fzilla.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=124"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ucsbwebdev.fzilla.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=124"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}