{"id":135010,"date":"2024-02-21T17:09:59","date_gmt":"2024-02-21T11:39:59","guid":{"rendered":"https:\/\/www.vskills.in\/certification\/tutorial\/?page_id=135010"},"modified":"2024-04-12T14:34:55","modified_gmt":"2024-04-12T09:04:55","slug":"adding-styling-to-your-html-with-css-code-for-beginners","status":"publish","type":"page","link":"https:\/\/www.vskills.in\/certification\/tutorial\/adding-styling-to-your-html-with-css-code-for-beginners\/","title":{"rendered":"Adding Styling to Your HTML with CSS Code for Beginners"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>Adding Styling to Your HTML with CSS Code for Beginners: A Practical Guide<\/strong><\/h2>\n\n\n\n<p>Welcome to the world of web design! This guide will equip you with the foundational knowledge to transform your plain HTML pages into visually stunning websites using Cascading Style Sheets (CSS). Forget metaphors, let&#8217;s delve directly into practical steps and clear explanations.<\/p>\n\n\n\n<p><strong>What is CSS?<\/strong><\/p>\n\n\n\n<p>Imagine HTML as the skeleton of your website, defining its structure and content. CSS acts as the paint and decorations, bringing that structure to life with colors, fonts, layouts, and more. It allows you to separate presentation (CSS) from content (HTML), leading to cleaner, more maintainable code.<\/p>\n\n\n\n<p><strong>Getting Started<\/strong><\/p>\n\n\n\n<p>There are three ways to integrate CSS into your HTML:<\/p>\n\n\n\n<ol class=\"wp-block-list\" type=\"1\" start=\"1\">\n<li>Inline Styles: These are directly embedded within HTML elements using the style attribute. Suitable for minor tweaks, but not recommended for large-scale styling.<\/li>\n\n\n\n<li>Internal Stylesheets: Place your CSS code within a &lt;style> tag inside the &lt;head> section of your HTML file. Ideal for small projects or quick prototypes.<\/li>\n\n\n\n<li>External Stylesheets: Create separate .css files containing your CSS rules and link them to your HTML using the &lt;link> tag in the &lt;head>. This is the preferred approach for organized and reusable styles.<\/li>\n<\/ol>\n\n\n\n<p><strong>Basic Building Blocks<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Selectors: These identify the HTML elements you want to style. Examples include element names (e.g., p, h1), class names (preceded by ., e.g., .highlight), and ID names (preceded by #, e.g., #main-banner).<\/li>\n\n\n\n<li>Properties: These specify the visual aspects you want to control, like font-size, color, background-color, margin, and padding.<\/li>\n\n\n\n<li>Values: These define how the property will be applied. For example, setting font-size to 16px or color to #ff0000 (red).<\/li>\n<\/ul>\n\n\n\n<p><strong>Styling Essentials<\/strong><\/p>\n\n\n\n<ol class=\"wp-block-list\" type=\"1\" start=\"1\">\n<li>Text Formatting: Control font size, family, weight, color, and decoration to enhance readability and create visual hierarchy.<\/li>\n\n\n\n<li>Backgrounds: Set background colors, images, or gradients for distinct sections or decorative elements.<\/li>\n\n\n\n<li>Borders and Spacing: Define borders around elements for separation and use margin and padding to control spacing within and around elements.<\/li>\n<\/ol>\n\n\n\n<p><strong>Putting it Together<\/strong><\/p>\n\n\n\n<p>Here&#8217;s a basic example:<\/p>\n\n\n\n<p>HTML<\/p>\n\n\n\n<p>&lt;!DOCTYPE html><\/p>\n\n\n\n<p>&lt;html lang=&#8221;en&#8221;&gt;<\/p>\n\n\n\n<p>&lt;head&gt;<\/p>\n\n\n\n<p>&nbsp; &lt;meta charset=&#8221;UTF-8&#8243;&gt;<\/p>\n\n\n\n<p>&nbsp; &lt;meta name=&#8221;viewport&#8221; content=&#8221;width=device-width, initial-scale=1.0&#8243;&gt;<\/p>\n\n\n\n<p>&nbsp; &lt;title&gt;My Styled Website&lt;\/title&gt;<\/p>\n\n\n\n<p>&nbsp; &lt;link rel=&#8221;stylesheet&#8221; href=&#8221;style.css&#8221;&gt;<\/p>\n\n\n\n<p>&lt;\/head&gt;<\/p>\n\n\n\n<p>&lt;body&gt;<\/p>\n\n\n\n<p>&nbsp; &lt;h1&gt;This is a heading&lt;\/h1&gt;<\/p>\n\n\n\n<p>&nbsp; &lt;p&gt;This is a paragraph with some &lt;span class=&#8221;highlight&#8221;&gt;highlighted text&lt;\/span&gt;.&lt;\/p&gt;<\/p>\n\n\n\n<p>&lt;\/body&gt;<\/p>\n\n\n\n<p>&lt;\/html&gt;<\/p>\n\n\n\n<p>CSS<\/p>\n\n\n\n<p>\/* style.css *\/<\/p>\n\n\n\n<p>h1 {<\/p>\n\n\n\n<p>&nbsp; font-family: Arial, sans-serif;<\/p>\n\n\n\n<p>&nbsp; font-size: 24px;<\/p>\n\n\n\n<p>&nbsp; text-align: center;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>p {<\/p>\n\n\n\n<p>&nbsp; font-size: 16px;<\/p>\n\n\n\n<p>&nbsp; line-height: 1.5;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>.highlight {<\/p>\n\n\n\n<p>&nbsp; color: red;<\/p>\n\n\n\n<p>&nbsp; font-weight: bold;<\/p>\n\n\n\n<p>}<\/p>\n\n\n\n<p>This code adds a heading with a larger font and centered text, styles the paragraph with line spacing, and highlights specific text in red and bold.<\/p>\n\n\n\n<p><strong>Keep in Mind<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Experiment! Practice writing CSS and observe the changes to solidify your understanding.<\/li>\n\n\n\n<li>Validate your code with online tools like the W3C CSS Validator: [<a href=\"https:\/\/jigsaw.w3.org\/css-validator\/\">https:\/\/jigsaw.w3.org\/css-validator\/<\/a>].<\/li>\n\n\n\n<li>Utilize online resources like MDN Web Docs and W3Schools for further exploration.<\/li>\n<\/ul>\n\n\n\n<p>Remember: Mastering CSS opens doors to creating visually appealing and impactful web experiences. This guide is your first step on that exciting journey!<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong><a href=\"https:\/\/www.vskills.in\/certification\/tutorial\/certified-front-end-web-developer\/\" target=\"_blank\" rel=\"noreferrer noopener\">Go back to tutorial<\/a><\/strong><\/h4>\n","protected":false},"excerpt":{"rendered":"<p>Adding Styling to Your HTML with CSS Code for Beginners: A Practical Guide Welcome to the world of web design! This guide will equip you with the foundational knowledge to transform your plain HTML pages into visually stunning websites using Cascading Style Sheets (CSS). Forget metaphors, let&#8217;s delve directly into practical steps and clear explanations&#8230;.<\/p>\n","protected":false},"author":15,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"categories":[5743],"tags":[],"class_list":["post-135010","page","type-page","status-publish","hentry","category-web-development"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Adding Styling to Your HTML with CSS Code for Beginners - Tutorial<\/title>\n<meta name=\"description\" content=\"Boost your chances and get ready to become a Vskills Certified Front-End Web Developer. Become job ready now!\" \/>\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.vskills.in\/certification\/tutorial\/adding-styling-to-your-html-with-css-code-for-beginners\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Adding Styling to Your HTML with CSS Code for Beginners - Tutorial\" \/>\n<meta property=\"og:description\" content=\"Boost your chances and get ready to become a Vskills Certified Front-End Web Developer. Become job ready now!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.vskills.in\/certification\/tutorial\/adding-styling-to-your-html-with-css-code-for-beginners\/\" \/>\n<meta property=\"og:site_name\" content=\"Tutorial\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/vskills.in\/\" \/>\n<meta property=\"article:modified_time\" content=\"2024-04-12T09:04:55+00:00\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/adding-styling-to-your-html-with-css-code-for-beginners\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/adding-styling-to-your-html-with-css-code-for-beginners\/\",\"name\":\"Adding Styling to Your HTML with CSS Code for Beginners - Tutorial\",\"isPartOf\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\"},\"datePublished\":\"2024-02-21T11:39:59+00:00\",\"dateModified\":\"2024-04-12T09:04:55+00:00\",\"description\":\"Boost your chances and get ready to become a Vskills Certified Front-End Web Developer. Become job ready now!\",\"breadcrumb\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/adding-styling-to-your-html-with-css-code-for-beginners\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.vskills.in\/certification\/tutorial\/adding-styling-to-your-html-with-css-code-for-beginners\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/adding-styling-to-your-html-with-css-code-for-beginners\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Adding Styling to Your HTML with CSS Code for Beginners\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#website\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"name\":\"Tutorial\",\"description\":\"Vskills - A initiative in elearning and certification\",\"publisher\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#organization\",\"name\":\"Vskills\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"contentUrl\":\"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg\",\"width\":73,\"height\":55,\"caption\":\"Vskills\"},\"image\":{\"@id\":\"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/vskills.in\/\",\"https:\/\/x.com\/vskills_in\",\"https:\/\/www.linkedin.com\/company-beta\/1371554\/\",\"https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Adding Styling to Your HTML with CSS Code for Beginners - Tutorial","description":"Boost your chances and get ready to become a Vskills Certified Front-End Web Developer. Become job ready now!","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.vskills.in\/certification\/tutorial\/adding-styling-to-your-html-with-css-code-for-beginners\/","og_locale":"en_US","og_type":"article","og_title":"Adding Styling to Your HTML with CSS Code for Beginners - Tutorial","og_description":"Boost your chances and get ready to become a Vskills Certified Front-End Web Developer. Become job ready now!","og_url":"https:\/\/www.vskills.in\/certification\/tutorial\/adding-styling-to-your-html-with-css-code-for-beginners\/","og_site_name":"Tutorial","article_publisher":"https:\/\/www.facebook.com\/vskills.in\/","article_modified_time":"2024-04-12T09:04:55+00:00","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/adding-styling-to-your-html-with-css-code-for-beginners\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/adding-styling-to-your-html-with-css-code-for-beginners\/","name":"Adding Styling to Your HTML with CSS Code for Beginners - Tutorial","isPartOf":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website"},"datePublished":"2024-02-21T11:39:59+00:00","dateModified":"2024-04-12T09:04:55+00:00","description":"Boost your chances and get ready to become a Vskills Certified Front-End Web Developer. Become job ready now!","breadcrumb":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/adding-styling-to-your-html-with-css-code-for-beginners\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.vskills.in\/certification\/tutorial\/adding-styling-to-your-html-with-css-code-for-beginners\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/adding-styling-to-your-html-with-css-code-for-beginners\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.vskills.in\/certification\/tutorial\/"},{"@type":"ListItem","position":2,"name":"Adding Styling to Your HTML with CSS Code for Beginners"}]},{"@type":"WebSite","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#website","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","name":"Tutorial","description":"Vskills - A initiative in elearning and certification","publisher":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.vskills.in\/certification\/tutorial\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#organization","name":"Vskills","url":"https:\/\/www.vskills.in\/certification\/tutorial\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/","url":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","contentUrl":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-content\/uploads\/2017\/07\/vskills-min-logo.jpg","width":73,"height":55,"caption":"Vskills"},"image":{"@id":"https:\/\/www.vskills.in\/certification\/tutorial\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/vskills.in\/","https:\/\/x.com\/vskills_in","https:\/\/www.linkedin.com\/company-beta\/1371554\/","https:\/\/www.youtube.com\/channel\/UCMWnscxPwRF_PqXo9B7q_Tw"]}]}},"_links":{"self":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/135010","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/comments?post=135010"}],"version-history":[{"count":3,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/135010\/revisions"}],"predecessor-version":[{"id":135187,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/pages\/135010\/revisions\/135187"}],"wp:attachment":[{"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/media?parent=135010"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/categories?post=135010"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.vskills.in\/certification\/tutorial\/wp-json\/wp\/v2\/tags?post=135010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}