Lädt...


🔧 Formatting HTML and CSS For Beginners


Nachrichtenbereich: 🔧 Programmierung
🔗 Quelle: dev.to

Well, I see it's been a long time since I last posted here. A lot of interesting stuff have happened over the past few years! But let's get back to the subject - you want to know how to format your HTML and CSS correctly, and this is how you're going to do it.

Some Benefits of Styling with CSS

Many of these benefits also translate to HTML too, when you organize your markup using HTML5 elements.

  • By keeping style separate from structure, CSS allows for cleaner, more maintainable code. This separation improves content accessibility and makes styling changes across a website much more manageable.

  • CSS provides extensive control over the presentation, from fonts to layout, enabling developers to create responsive designs that adapt across devices.

  • External CSS files can be cached, improving load times for subsequent page views.

Techniques for Applying CSS With Your HTML

CSS can be applied in three primary ways:

  1. Inline Styling: Using the style attribute directly within HTML elements. While this method is straightforward, it's generally discouraged for its lack of maintainability.
   <p style="color: blue;">This text is blue.</p>
  1. Internal Styling: Using a <style> tag in the HTML <head>. This method is useful for small projects or unique styling for a single page.
   <style>
   p {
       color: red;
   }
   </style>
  1. External Styling: Linking to a separate .css file, which is the most recommended for extensive projects due to its maintainability and reusability.
   <link rel="stylesheet" href="styles.css">

In styles.css:

   p {
       color: green;
   }

Best Practices

  • Use Semantic HTML, as I wrote above.

  • Avoid Inline Styles.

  • Prefer Classes Over IDs when creating selectors.

  • Consider organizing your CSS properties alphabetically.

  • Use class names that are descriptive but avoid overly specific selectors that might conflict or be hard to override.

  • Use Media Queries. They're good for responsive design. I cannot stress this enough.

On a different note...

Did you know that I am running a free eBook giveaway on X/Twitter? You will learn how Google formats their own HTML and CSS and their own advice. If you like free stuff, then check out my tweet.

...

🔧 Formatting HTML and CSS For Beginners


📈 38.65 Punkte
🔧 Programmierung

🔧 Introduction of CSS, What is CSS, Why we use CSS and How CSS describe the HTML elements


📈 34.48 Punkte
🔧 Programmierung

🔧 Introducing More Python for Beginners | More Python for Beginners [1 of 20] | More Python for Beginners


📈 28.58 Punkte
🔧 Programmierung

🔧 HTML & CSS Tutorial for Beginners - Lists, Tables, Forms, Advanced CSS Selectors | Web Design


📈 28.21 Punkte
🔧 Programmierung

🎥 Formatting and Linting | More Python for Beginners [2 of 20]


📈 27.22 Punkte
🎥 Video | Youtube

🔧 Set up linting and formatting for code and (S)CSS files in a Next.js project


📈 26.24 Punkte
🔧 Programmierung

🎥 Demo: Formatting Strings | Python for Beginners [12 of 44]


📈 25.92 Punkte
🎥 Video | Youtube

🎥 Formatting Strings | Python for Beginners [11 of 44]


📈 25.92 Punkte
🎥 Video | Youtube

🔧 CSS Variables (CSS Custom properties) for Beginners


📈 24.03 Punkte
🔧 Programmierung

🔧 Solving Media Object Float Issues With CSS Block Formatting Contexts


📈 23.64 Punkte
🔧 Programmierung

🔧 CSS Grid: Moving From CSS Frameworks To CSS Grid (2018 and beyond)


📈 23.05 Punkte
🔧 Programmierung

🔧 A BRIEF REVIEW OF CSS CASCADING, CSS SELECTORS and CSS SPECIFICITY.


📈 23.05 Punkte
🔧 Programmierung

🔧 How to create navigation menu with HTML CSS step by step | web design tutorial | HTML CSS tutorial


📈 22.87 Punkte
🔧 Programmierung

🔧 Cursor Trail using html css js #virals #js #html #css #work


📈 22.87 Punkte
🔧 Programmierung

🔧 Day 2: Text Formatting and Links in HTML


📈 21.87 Punkte
🔧 Programmierung

🔧 Stylify CSS: Automagic CSS bundles splitting into CSS layers in Astro.build


📈 21.75 Punkte
🔧 Programmierung

🔧 Choosing the Right CSS Approach: Tailwind CSS vs Bootstrap vs Vanilla CSS


📈 21.75 Punkte
🔧 Programmierung

🔧 HTML and CSS and JS icons (css pure)


📈 21.28 Punkte
🔧 Programmierung

🎥 Firebase Tutorial for Beginners – Build a Mobile App with HTML, CSS, JavaScript


📈 20.96 Punkte
🎥 Video | Youtube

🎥 Build a Simple Website with HTML, CSS, JavaScript – Course for Beginners


📈 20.96 Punkte
🎥 Video | Youtube

🎥 Web Development with HTML & CSS – Full Course for Beginners


📈 20.96 Punkte
🎥 Video | Youtube

🔧 Guides to the Web Performance - HTML + CSS - For Beginners


📈 20.96 Punkte
🔧 Programmierung

🔧 HTML/CSS tips for beginners


📈 20.96 Punkte
🔧 Programmierung

🔧 HTML & CSS for Beginners: Build Your First Website Step-by-Step | The Coder Compass


📈 20.96 Punkte
🔧 Programmierung

🐧 HTML Text Formatting


📈 20.57 Punkte
🐧 Linux Tipps

🔧 HTML in 180 Seconds: Episode 4 - Basic Text Formatting


📈 20.57 Punkte
🔧 Programmierung

🔧 Build a Tic Tac Toe Game using HTML, CSS, JavaScript, Tailwind CSS and Canvas Confetti


📈 19.98 Punkte
🔧 Programmierung

🔧 Complete Website using HTML And CSS | CSS Project


📈 19.98 Punkte
🔧 Programmierung

🔧 I need some help running a zip file containing html, js, css. Would also like js and css to be edited.


📈 19.98 Punkte
🔧 Programmierung

🔧 A practical way to test HTML and CSS in real-time using only CSS.


📈 19.98 Punkte
🔧 Programmierung

🔧 A practical way to test HTML and CSS in real-time using only CSS.


📈 19.98 Punkte
🔧 Programmierung

🔧 Responsive Admin Dashboard Page HTML, CSS And Javascript - CSS Admin Template


📈 19.98 Punkte
🔧 Programmierung

🔧 Python for Beginners [1 of 44] Programming with Python | Python for Beginners


📈 19.06 Punkte
🔧 Programmierung

matomo