From 4eacddaa411b389e815d5f307635d93cf81ef51c Mon Sep 17 00:00:00 2001 From: medusa Date: Mon, 30 Jun 2025 08:25:08 +0000 Subject: [PATCH] Update tech_docs/webdev/html_css_standards.md --- tech_docs/webdev/html_css_standards.md | 424 +++++++++++++++---------- 1 file changed, 263 insertions(+), 161 deletions(-) diff --git a/tech_docs/webdev/html_css_standards.md b/tech_docs/webdev/html_css_standards.md index 62cf7b5..36ee2cc 100644 --- a/tech_docs/webdev/html_css_standards.md +++ b/tech_docs/webdev/html_css_standards.md @@ -1,194 +1,296 @@ # Coding Standards Documentation ## Introduction -This document outlines the common HTML class naming conventions and structure to ensure consistent, readable, and maintainable code in our web projects. -## Buttons +This document outlines our **HTML class naming conventions** and **structural guidelines**. Adhering to these standards ensures **consistent, readable, and maintainable code** across all web projects. Our goal is to facilitate **seamless team collaboration**, **reduce development time**, and **improve long-term code maintainability**. -- `.btn`: - - **Description**: Used to style generic buttons. - - **Example**: `` -- `.btn--large`: - - **Description**: Styles large buttons. - - **Example**: `` -- `.btn--small`: - - **Description**: Styles small buttons. - - **Example**: `` +----- -## Layout +## HTML Class Naming Conventions -- `.container`: - - **Description**: Wraps the main content of a web page, centering the content and limiting its width. - - **Example**: `
...
` -- `.row`: - - **Description**: Creates horizontal rows of elements. - - **Example**: `
...
` -- `.col`: - - **Description**: Divides a `.row` into vertical columns. Width is often defined by additional classes or styles. - - **Example**: `
...
` +We'll primarily use a **BEM (Block Element Modifier)-like approach** for class naming. This method provides clarity, prevents naming collisions, and makes our CSS more modular and scalable. -## Sections +### Buttons -- `.header`: - - **Description**: Styles the top section of a web page, including the navigation bar and logo. - - **Example**: `
...
` -- `.main`: - - **Description**: Styles the main content area of a web page. - - **Example**: `
...
` -- `.footer`: - - **Description**: Styles the footer of a web page. - - **Example**: `` +Buttons are fundamental interactive elements. These classes ensure consistent styling and clear intent. -## Forms + * **`.btn`** + * **Description**: Applies **base styles** to all buttons (e.g., `display`, `padding`, `border-radius`). This is the foundation for all button variations. + * **Usage**: `` + * **`.btn--primary`**, **`.btn--secondary`**, etc. + * **Description**: Defines different **semantic styles** for buttons (e.g., primary action, secondary action). These classes typically apply specific colors, background colors, and hover states. + * **Usage**: + * `` + * `` + * **`.btn--large`**, **`.btn--small`** + * **Description**: **Modifies the size** of the button, adjusting properties like `padding` and `font-size`. + * **Usage**: + * `` + * `` + * **`.btn--disabled`** + * **Description**: Visually indicates a **non-interactive button**, typically by dimming it and disabling pointer events. + * **Usage**: `` -- `.form`: - - **Description**: Styles the entirety of forms. - - **Example**: `
...
` -- `.input`: - - **Description**: Can style multiple form elements. Specific classes should be used for distinct input types. - - **Example**: `` -- `.text`, `.password`, `.checkbox`, `.radio`: - - **Description**: Styles individual types of inputs. - - **Examples**: - - Text: `` - - Password: `` - - Checkbox: `` - - Radio: `` +### Layout -## Tables +Layout classes help create consistent page structures and enable responsive design. -- `.table`: - - **Description**: Used to style tables of data. - - **Example**: `...
` + * **`.container`** + * **Description**: Wraps main page content, typically used to **center content** and **limit its maximum width**, often providing consistent horizontal padding. + * **Usage**: `
...
` + * **`.row`** + * **Description**: Creates **horizontal groupings of elements**, often leveraging Flexbox or Grid for column arrangement. + * **Usage**: `
...
` + * **`.col`**, **`.col--[breakpoint]-[size]`** (e.g., `.col--md-6`) + * **Description**: Divides a `.row` into **vertical columns**. Widths are typically defined by additional classes for responsiveness (e.g., `.col--md-6` for 50% width on medium screens and up), implying a foundational CSS grid system. + * **Usage**: + * `
...
` + * `
...
` -## Images +### Sections -- `.image`: - - **Description**: Styles generic images. +These classes define the main structural blocks of a web page, improving semantic understanding and styling. -# Usage of Inline and Block Elements + * **`.header`** + * **Description**: Styles the **top section of a web page**, commonly containing the site logo, navigation, and search bar. + * **Usage**: `
...
` + * **`.main`** + * **Description**: Styles the **primary content area** of a web page. Ideally, there should be only one `
` element per document. + * **Usage**: `
...
` + * **`.footer`** + * **Description**: Styles the **bottom section of a web page**, often including copyright information or sitemaps. + * **Usage**: `
...
` + * **`.section`** + * **Description**: A generic class for **thematic groupings of content**, useful for applying consistent padding, margins, or background styles. + * **Usage**: `
...
` -Understanding the difference between inline and block elements is pivotal for structuring and styling web content effectively. +### Forms -## Inline Elements +Form classes ensure a consistent look and feel for user input elements. -Inline elements do not start on a new line and take up as much width as necessary. They're like words in a sentence — they flow with the content. - -Examples include: - -- **Links (``):** Hyperlinks to another resource. - - **Usage**: `Visit Example` -- **Images (``):** Embeds an image. - - **Usage**: `Description` -- **Strong Emphasis (``):** Denotes strong importance, typically displayed as bold. - - **Usage**: `Important text.` -- **Emphasis (``):** Gives emphasized text, usually rendered as italic. - - **Usage**: `Emphasized text.` -- **Code (``):** Designates a single line of code. - - **Usage**: `let x = 10;` -- **Span (``):** Generic inline container for phrasing content. Doesn't convey any meaning on its own. - - **Usage**: `Highlighted text` -- **Abbreviations (``):** Represents an abbreviation or acronym. - - **Usage**: `HTML` -- **Inline Quotation (``):** Denotes a short inline quotation. - - **Usage**: `Cogito, ergo sum` - -## Block Elements - -Block elements start on a new line and typically take up the full width of their parent container. - -Examples include: - -- **Paragraphs (`

`):** Denotes a block of text. - - **Usage**: `

This is a paragraph.

` -- **Headings (`

` to `

`):** Mark section headings, with `

` being the most prominent and `

` the least. - - **Usage**: - - `

Main Title

` - - `

Subheading

` - - ... - - `
Smallest Subheading
` -- **Lists:** - - **Unordered (`
    `):** List without a specific order. - - **Usage**: - ```html -
      -
    • Apple
    • -
    • Banana
    • -
    - ``` - - **Ordered (`
      `):** Numbered list. - - **Usage**: - ```html -
        -
      1. First item
      2. -
      3. Second item
      4. -
      - ``` - - **Description (`
      `):** List of terms with their descriptions. - - **Usage**: - ```html -
      -
      Browser
      -
      A software used to access the web.
      -
      - ``` -- **Divisions (`
      `):** Generic container that groups content. - - **Usage**: `
      ...
      ` -- **Block Quotation (`
      `):** Represents a section quoted from another source. - - **Usage**: + * **`.form`** + * **Description**: Styles the **entire form container**, applying general layout and spacing rules to its elements. + * **Usage**: `
      ...
      ` + * **`.form__group`** + * **Description**: Groups related form elements (e.g., a label and its input) for consistent vertical spacing. + * **Usage**: ```html -
      - This is a block quote from another source. -
      +
      + + +
      ``` -- **Tables (``):** Represents tabular data. - - **Usage**: + * **`.input`** + * **Description**: Applies **base styles to generic text-based input fields** (``, ``, `