{"id":968,"date":"2011-09-02T16:30:54","date_gmt":"2011-09-02T16:30:54","guid":{"rendered":"https:\/\/www.inmotionhosting.com\/support\/2011\/09\/02\/using-css-website\/"},"modified":"2020-10-02T17:18:27","modified_gmt":"2020-10-02T21:18:27","slug":"using-css-website","status":"publish","type":"post","link":"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/","title":{"rendered":"Using CSS in your Website"},"content":{"rendered":"<p>We&#8217;ve mentioned previously that there are three methods of using CSS: external, internal, and inline. \u00a0In this tutorial we will go over each method with more detail.<\/p>\n<h2>Creating an External Style Sheet<\/h2>\n<p>An external style sheet, is a separate file storing all of your formatting.\u00a0 Then for each page that you want to use that style (or all your pages), you would simply add this code if your stylesheet is a file named style.css:<\/p>\n<pre class=\"code_block\">&lt;head&gt;\n&lt;link rel=\"stylesheet\" type=\"text\/css\" href=\"style.css\" \/&gt;\n&lt;\/head&gt;<\/pre>\n<p>On each page you wish to use the style sheet for, insert style.css (this is the actual file that has your style, you can name it anything you want to) in the &lt;head&gt; section of your webpage. We still have not discussed how to create the actual CSS file. Open up your notepad or any other text editor you have on your computer.\u00a0 Next, type in the style that you want that CSS file to have.\u00a0 For example, if you wanted to set the background color as red, the main text (paragraph text) as black, and the header as blue, you would type in:<\/p>\n<pre class=\"code_block\">body{ background-color: red;} \np { color: black; } \nh1{ color: blue; }<\/pre>\n<p>When you have finished the styles you want in this CSS file, click on &#8220;Save As&#8221; and save the file as style.css.\u00a0 Now it is a css file.\u00a0 To use the stylesheet, you will need to upload the .css file to your server either by FTP or through file manager in cPanel.\u00a0 After you have created your css file and included it using the code above, all of the styles you specified in the file will be applied to your web page. You can add as many different style sheets on one page as you need, but generally it is best practice to use only one or two.<\/p>\n<h2>Creating an Internal Style Sheet<\/h2>\n<p>To have a style only be used on one page, you will add the properties within the &lt;style&gt; &lt;\/style&gt; tag in the head.\u00a0 Unlike the External Style Sheet, you do not have to create a separate file as it will all be contained on the page.\u00a0 Open the page that you want to add a style sheet for and go to the &lt;head&gt; section. The internal style sheet must be placed in the &lt;head&gt; section or they will not work.\u00a0 For example, if you want all your paragraphs to have black text and the background to be red, you would place the following in your head tag:<\/p>\n<pre class=\"code_block\">&lt;html&gt;\n&lt;head&gt;\n<strong>&lt;style type=\"text\/css\"&gt;<\/strong>\n<strong>p {color: black; }<\/strong>\n<strong>body {background-color: red; }<\/strong>\n<strong>&lt;\/style&gt;<\/strong>\n&lt;\/head&gt;<\/pre>\n<p>Remember for the text to be the color specified, it will only take effect if you use the &lt;p&gt; tags within the page as that is the only text that will be effected.\u00a0 If you have a &lt;h1&gt; tag and want to change the color of those as well for example, you will need to add another line to the style:<\/p>\n<pre class=\"code_block\">&lt;html&gt;\n&lt;head&gt;\n<strong style=\"font-weight: bold;\">&lt;style type=\"text\/css\"&gt;<\/strong>\n<strong style=\"font-weight: bold;\">p {color: black; }<\/strong>\n<strong style=\"font-weight: bold;\">body {background-color: red; }\nh1 {color: black }\n&lt;\/style&gt;<\/strong>\n&lt;\/head&gt;<\/pre>\n<p>Now all the text on that page with a &lt;p&gt; or an &lt;h1&gt; tag will be changed.\u00a0 Remember this will not effect other pages, but only the page that has the &lt;style&gt; changes in the header.<\/p>\n<h2>Creating an Inline Style<\/h2>\n<p>This is the simplest method to using CSS, but since it has to be done to each tag individually it is also the most time consuming.\u00a0 You will us an Inline Style if there is just one element that you want to change, for example if all the paragraphs on your page are black but you want one to be red, then you can add an Inline Style to that paragraph:<\/p>\n<pre class=\"code_block\">&lt;p style=\"color: red;\"&gt;I want this paragraph to be red instead of black.&lt;\/p&gt;<\/pre>\n<p>Now on your page, the other paragraphs will still be black but any text within the &lt;p&gt; &lt;\/p&gt; tags as shown above will now be red.\u00a0 This can be repeated as many times as necessary on the web page.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We&#8217;ve mentioned previously that there are three methods of using CSS: external, internal, and inline. \u00a0In this tutorial we will go over each method with more detail. Creating an External Style Sheet An external style sheet, is a separate file storing all of your formatting.\u00a0 Then for each page that you want to use that<a class=\"moretag\" href=\"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/\"> Read More ><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[4288],"tags":[],"class_list":["post-968","post","type-post","status-publish","format-standard","hentry","category-website"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Using CSS in your Website | InMotion Hosting<\/title>\n<meta name=\"description\" content=\"Learn how to add CSS in your website.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using CSS in your Website | InMotion Hosting\" \/>\n<meta property=\"og:description\" content=\"Learn how to add CSS in your website.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/\" \/>\n<meta property=\"og:site_name\" content=\"InMotion Hosting Support Center\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/inmotionhosting\/\" \/>\n<meta property=\"article:published_time\" content=\"2011-09-02T16:30:54+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-10-02T21:18:27+00:00\" \/>\n<meta name=\"author\" content=\"Brad Markle\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:site\" content=\"@InMotionHosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Brad Markle\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/\"},\"author\":{\"name\":\"Brad Markle\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5ae05d1210b0ef63c437ccedce2799bf\"},\"headline\":\"Using CSS in your Website\",\"datePublished\":\"2011-09-02T16:30:54+00:00\",\"dateModified\":\"2020-10-02T21:18:27+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/\"},\"wordCount\":642,\"commentCount\":6,\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"articleSection\":[\"Website\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/\",\"name\":\"Using CSS in your Website | InMotion Hosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\"},\"datePublished\":\"2011-09-02T16:30:54+00:00\",\"dateModified\":\"2020-10-02T21:18:27+00:00\",\"description\":\"Learn how to add CSS in your website.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.inmotionhosting.com\/support\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Using CSS in your Website\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#website\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"name\":\"InMotion Hosting Support Center\",\"description\":\"Web Hosting Support &amp; Tutorials\",\"publisher\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#organization\",\"name\":\"InMotion Hosting\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"contentUrl\":\"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg\",\"width\":696,\"height\":696,\"caption\":\"InMotion Hosting\"},\"image\":{\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/inmotionhosting\/\",\"https:\/\/x.com\/InMotionHosting\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5ae05d1210b0ef63c437ccedce2799bf\",\"name\":\"Brad Markle\",\"url\":\"https:\/\/www.inmotionhosting.com\/support\/author\/bradm\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Using CSS in your Website | InMotion Hosting","description":"Learn how to add CSS in your website.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/","og_locale":"en_US","og_type":"article","og_title":"Using CSS in your Website | InMotion Hosting","og_description":"Learn how to add CSS in your website.","og_url":"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/","og_site_name":"InMotion Hosting Support Center","article_publisher":"https:\/\/www.facebook.com\/inmotionhosting\/","article_published_time":"2011-09-02T16:30:54+00:00","article_modified_time":"2020-10-02T21:18:27+00:00","author":"Brad Markle","twitter_card":"summary_large_image","twitter_creator":"@InMotionHosting","twitter_site":"@InMotionHosting","twitter_misc":{"Written by":"Brad Markle","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/#article","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/"},"author":{"name":"Brad Markle","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5ae05d1210b0ef63c437ccedce2799bf"},"headline":"Using CSS in your Website","datePublished":"2011-09-02T16:30:54+00:00","dateModified":"2020-10-02T21:18:27+00:00","mainEntityOfPage":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/"},"wordCount":642,"commentCount":6,"publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"articleSection":["Website"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/","url":"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/","name":"Using CSS in your Website | InMotion Hosting","isPartOf":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#website"},"datePublished":"2011-09-02T16:30:54+00:00","dateModified":"2020-10-02T21:18:27+00:00","description":"Learn how to add CSS in your website.","breadcrumb":{"@id":"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.inmotionhosting.com\/support\/website\/using-css-website\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.inmotionhosting.com\/support\/"},{"@type":"ListItem","position":2,"name":"Using CSS in your Website"}]},{"@type":"WebSite","@id":"https:\/\/www.inmotionhosting.com\/support\/#website","url":"https:\/\/www.inmotionhosting.com\/support\/","name":"InMotion Hosting Support Center","description":"Web Hosting Support &amp; Tutorials","publisher":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.inmotionhosting.com\/support\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.inmotionhosting.com\/support\/#organization","name":"InMotion Hosting","url":"https:\/\/www.inmotionhosting.com\/support\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/","url":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","contentUrl":"https:\/\/www.inmotionhosting.com\/support\/wp-content\/uploads\/2023\/02\/inmotion-hosting-logo-yoast.jpg","width":696,"height":696,"caption":"InMotion Hosting"},"image":{"@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/inmotionhosting\/","https:\/\/x.com\/InMotionHosting"]},{"@type":"Person","@id":"https:\/\/www.inmotionhosting.com\/support\/#\/schema\/person\/5ae05d1210b0ef63c437ccedce2799bf","name":"Brad Markle","url":"https:\/\/www.inmotionhosting.com\/support\/author\/bradm\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"primary_category":null,"_links":{"self":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/968","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/comments?post=968"}],"version-history":[{"count":3,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/968\/revisions"}],"predecessor-version":[{"id":61343,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/posts\/968\/revisions\/61343"}],"wp:attachment":[{"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/media?parent=968"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/categories?post=968"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inmotionhosting.com\/support\/wp-json\/wp\/v2\/tags?post=968"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}