structure updates
This commit is contained in:
430
tech_docs/webdev/advanced_html.md
Normal file
430
tech_docs/webdev/advanced_html.md
Normal file
@@ -0,0 +1,430 @@
|
||||
## Getting Started with Web Development: From Basics to Advanced HTML, CSS, and Sass Topics
|
||||
|
||||
Welcome to this comprehensive guide on web development. Whether you're a beginner aspiring to become a skilled web developer or looking to enhance your skills, this guide will walk you through essential and advanced concepts in HTML, CSS, and Sass. Let's dive in!
|
||||
|
||||
### **Commonly Used Items**
|
||||
|
||||
#### **HTML**
|
||||
|
||||
- **Basic HTML Syntax and Structure**: Understanding the fundamental syntax and structuring principles.
|
||||
- **Document Structure**: Skeleton, headings, and layout essentials.
|
||||
- **HTML Tags and Elements**: Differentiating between block and inline elements and familiarizing with common tags.
|
||||
- **Semantic Elements**: Learn about common elements like `header`, `footer`, `nav`, etc., and their roles in web development.
|
||||
- **Forms and Input Types**: Grasping the essential forms and various input types to facilitate user interaction on a webpage.
|
||||
|
||||
## Semantic HTML
|
||||
|
||||
Semantic HTML is the practice of using HTML elements to describe the meaning of their content, rather than just their appearance. This makes your code more readable and maintainable, and it also helps search engines to understand your content better.
|
||||
|
||||
Here are some examples of semantic HTML elements:
|
||||
|
||||
- `<header>`: Used to mark the header of a document
|
||||
- `<footer>`: Used to mark the footer of a document
|
||||
- `<nav>`: Used to mark the navigation section of a document
|
||||
- `<main>`: Used to mark the main content of a document
|
||||
- `<article>`: Used to mark a self-contained piece of content, such as a blog post or news article
|
||||
|
||||
#### **CSS**
|
||||
|
||||
- **Basic CSS**: Understanding syntax, selectors, and basic properties.
|
||||
- **Box Model**: Learning about the CSS box model which includes margins, borders, and padding.
|
||||
- **Colors, Fonts, and Units**: Getting familiar with color schemes, typography, and measurement units in CSS.
|
||||
- **Flexbox and Grid Layout**: A deep dive into creating responsive designs using flexbox and grid systems.
|
||||
- **Media Queries**: Learning to design responsive websites that adapt to different device characteristics.
|
||||
|
||||
#### **Sass**
|
||||
|
||||
- **Basic Sass Syntax**: Understanding the foundational syntax of Sass.
|
||||
- **Variables**: Learning to store reusable values using variables.
|
||||
- **Nesting**: Grasping the nesting principles to maintain a cleaner and more readable Sass code.
|
||||
|
||||
---
|
||||
|
||||
### **Occasionally Used Items**
|
||||
|
||||
#### **HTML**
|
||||
|
||||
- **Multimedia Elements**: Enhancing web pages with audio and video elements.
|
||||
- **Graphics**: Incorporating SVG and Canvas to enrich web graphical content.
|
||||
- **HTML5 Features**: Deep diving into APIs and understanding deprecated elements to stay updated.
|
||||
|
||||
#### **CSS**
|
||||
|
||||
- **Transitions and Animations**: Creating dynamic and visually appealing web pages.
|
||||
- **Pseudo-classes and Pseudo-elements**: Utilizing these to style elements based on their state and position.
|
||||
- **Advanced CSS3 Features**: Learning 2D and 3D transformations to create depth and motion effects on web pages.
|
||||
- **CSS At-rules**: Understanding various at-rules and their applications in CSS:
|
||||
- **@font-face**
|
||||
- **@import**
|
||||
- **@keyframes**
|
||||
- **@media**
|
||||
- **@namespace**
|
||||
- **@page**
|
||||
- **@supports**
|
||||
|
||||
#### **Sass**
|
||||
|
||||
- **Mixins**: Learning to create reusable blocks of code in Sass.
|
||||
- **Functions**: Understanding and creating custom functions to facilitate various operations in Sass.
|
||||
|
||||
---
|
||||
|
||||
### **Accessibility**
|
||||
|
||||
Understanding and implementing the principles of accessibility to create websites usable by all individuals, including those with disabilities. Key considerations include:
|
||||
|
||||
- **Perceivable Information and User Interface**
|
||||
- **Operable UI Components**
|
||||
- **Understandable Information and UI**
|
||||
- **Robust Content and Reliable Interpretation**
|
||||
|
||||
### **Security**
|
||||
|
||||
Implementing strategies to maintain a secure website. Some tips include:
|
||||
|
||||
- **Strong Passwords**
|
||||
- **HTTPS**
|
||||
- **Regular Software Updates**
|
||||
|
||||
---
|
||||
|
||||
### **Used Only When Necessary**
|
||||
|
||||
#### **HTML**
|
||||
|
||||
- **Advanced HTML5 Features**: Leveraging web storage, geolocation, and other APIs for enhanced functionality.
|
||||
- **Complex Forms and Intricate Input Types**: Crafting advanced forms to gather a variety of user inputs.
|
||||
|
||||
### **Semantic HTML**
|
||||
|
||||
Semantic HTML is the practice of using HTML elements to describe the meaning of their content, rather than just their appearance. This makes your code more readable and maintainable, and it also helps search engines to understand your content better.
|
||||
|
||||
Here are some examples of semantic HTML elements:
|
||||
|
||||
- `<header>`: Used to mark the header of a document
|
||||
- `<footer>`: Used to mark the footer of a document
|
||||
- `<nav>`: Used to mark the navigation section of a document
|
||||
- `<main>`: Used to mark the main content of a document
|
||||
- `<article>`: Used to mark a self-contained piece of content, such as a blog post or news article
|
||||
|
||||
### **HTML5 Features**
|
||||
|
||||
HTML5 is the latest version of the HTML standard. It introduces a number of new features, such as:
|
||||
|
||||
- `<audio>` and `<video>` elements for embedding audio and video content
|
||||
- `<canvas>` element for drawing graphics
|
||||
- `<svg>` element for embedding SVG graphics
|
||||
- `localStorage` and `sessionStorage` APIs for storing data on the client side
|
||||
- `geolocation` API for getting the user's current location
|
||||
|
||||
#### **CSS**
|
||||
|
||||
- **CSS Variables**: Learning to use variables in CSS for more dynamic styling.
|
||||
- **Complex CSS Grid Layouts**: Creating intricate layouts using advanced grid techniques.
|
||||
|
||||
## Responsive Design
|
||||
|
||||
Responsive design is a web design approach that ensures that a website looks and functions well on all devices, regardless of screen size or orientation. This is important because more and more people are using mobile devices to access the internet.
|
||||
|
||||
To create a responsive website, you need to use CSS to create flexible layouts that can adapt to different screen sizes. You can also use media queries to target specific devices or screen sizes.
|
||||
|
||||
Here are some tips for creating responsive websites:
|
||||
|
||||
- Use fluid layouts instead of fixed layouts. Fluid layouts use relative units of measurement, such as percentages and viewport units, so that they can expand and contract to fit different screen sizes.
|
||||
- Use media queries to target specific devices or screen sizes. Media queries allow you to apply different CSS rules to different devices or screen sizes.
|
||||
- Use responsive images. Responsive images are images that can be resized to fit different screen sizes.
|
||||
|
||||
## **CSS Variables and Complex CSS Grid Layouts**
|
||||
|
||||
#### **CSS Variables**
|
||||
|
||||
CSS variables are a powerful tool for creating more dynamic and maintainable CSS code. They allow you to store values in variables and then use those variables throughout your CSS code. This can make your code more reusable and easier to maintain.
|
||||
|
||||
For example, you can use a CSS variable to store the primary color of your website. Then, you can use that variable in your CSS code to style different elements, such as the background color of your header and the text color of your navigation links.
|
||||
|
||||
Here is an example of how to use CSS variables:
|
||||
|
||||
```sass
|
||||
/* Define a CSS variable */
|
||||
:root {
|
||||
--primary-color: blue;
|
||||
}
|
||||
|
||||
/* Use the CSS variable to style elements */
|
||||
header {
|
||||
background-color: var(--primary-color);
|
||||
}
|
||||
|
||||
nav a {
|
||||
color: var(--primary-color);
|
||||
}
|
||||
```
|
||||
|
||||
#### **Complex CSS Grid Layouts**
|
||||
|
||||
CSS Grid is a powerful layout system that allows you to create complex layouts that can adapt to different screen sizes and devices. CSS Grid layouts are made up of rows and columns, and you can place elements within the grid using grid areas.
|
||||
|
||||
Complex CSS Grid layouts can be used to create a variety of layouts, such as:
|
||||
|
||||
- Multi-column layouts with different column widths
|
||||
- Layouts with nested grids
|
||||
- Layouts with sticky headers and footers
|
||||
- Layouts with flexible spacing
|
||||
|
||||
Here is an example of a complex CSS Grid layout:
|
||||
|
||||
```sass
|
||||
.container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
grid-template-rows: repeat(2, 1fr);
|
||||
|
||||
/* Place elements within the grid */
|
||||
.header {
|
||||
grid-area: 1 / 1 / 2 / 4;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
grid-area: 2 / 1 / 3 / 2;
|
||||
}
|
||||
|
||||
.content {
|
||||
grid-area: 2 / 2 / 3 / 4;
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
#### **Sass**
|
||||
|
||||
- **Control Directives**: Understanding control directives such as `if`, `for`, `each`, and `while` for advanced Sass functionalities.
|
||||
- **Advanced Sass Functionalities**: Creating custom functions and understanding other advanced functionalities in Sass.
|
||||
|
||||
## Sass
|
||||
|
||||
### **Mixins**
|
||||
|
||||
Mixins are reusable blocks of Sass code. They can be used to save time and effort, and to keep your code DRY (Don't Repeat Yourself).
|
||||
|
||||
To create a mixin, you use the `@mixin` directive. For example, the following mixin creates a button with a specific style:
|
||||
|
||||
```sass
|
||||
@mixin button {
|
||||
background-color: blue;
|
||||
color: white;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 4px;
|
||||
}
|
||||
```
|
||||
|
||||
## **Sass Control Directives and Advanced Sass Functionalities**
|
||||
|
||||
#### **Sass Control Directives**
|
||||
|
||||
Sass control directives allow you to add conditional logic and loops to your Sass code. This can make your code more reusable and efficient.
|
||||
|
||||
For example, you can use the @if directive to conditionally apply CSS rules. You can also use the @for loop to iterate over a list of values and apply CSS rules to each item in the list.
|
||||
|
||||
Here is an example of how to use Sass control directives:
|
||||
|
||||
```sass
|
||||
/* Use the @if directive to conditionally apply CSS rules */
|
||||
@if ($is-mobile) {
|
||||
body {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Use the @for loop to iterate over a list of values and apply CSS rules to each item in the list */
|
||||
@for $i from 1 to 3 {
|
||||
.item-#{$i} {
|
||||
margin: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
#### **Advanced Sass Functionalities**
|
||||
|
||||
Advanced Sass functionalities include custom functions, mixins, and importers.
|
||||
|
||||
- Custom functions allow you to create your own functions that can be used in your Sass code.
|
||||
- Mixins allow you to create reusable blocks of Sass code.
|
||||
- Importers allow you to import Sass code from other files.
|
||||
|
||||
Here is an example of how to use a custom Sass function:
|
||||
|
||||
```sass
|
||||
/* Define a custom Sass function */
|
||||
@function px-to-rem($px) {
|
||||
$rem: $px / 16;
|
||||
return $rem + "rem";
|
||||
}
|
||||
|
||||
/* Use the custom Sass function to convert pixels to rems */
|
||||
body {
|
||||
font-size: px-to-rem(16);
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## SEO
|
||||
|
||||
SEO stands for search engine optimization. It is the process of optimizing a website so that it ranks higher in search engine results pages (SERPs). This is important because it can help to drive more traffic to your website.
|
||||
|
||||
There are many different factors that affect SEO, including the content of your website, the structure of your website, and the links to your website from other websites.
|
||||
|
||||
Here are some tips for improving your website's SEO:
|
||||
|
||||
- Write high-quality content that is relevant to your target audience.
|
||||
- Optimize your website's title tags and meta descriptions.
|
||||
- Use relevant keywords throughout your website content.
|
||||
- Build backlinks to your website from other high-quality websites.
|
||||
|
||||
#### **Project-Based Learning**
|
||||
|
||||
- **Sass Project Structure**: Understanding and working with a structured Sass project.
|
||||
- **Compiling Sass to CSS**: Learning the process to compile Sass files into CSS.
|
||||
- **Utilizing Source Maps**: Grasping the use of source maps in Sass development.
|
||||
- **Version Control**: Getting acquainted with version control systems like Git for collaborative and controlled project development.
|
||||
|
||||
---
|
||||
|
||||
## **Conclusion**
|
||||
|
||||
You have now been introduced to a wide spectrum of concepts and elements vital in web development, encompassing the basics to advanced topics in HTML, CSS, and Sass. The learning doesn't stop here. Make sure to practice and experiment with what you have learned. Consider engaging in project-based learning to further solidify your understanding and to gain hands-on experience.
|
||||
|
||||
## **Resources**
|
||||
|
||||
As you venture into web development, here are some recommended resources for further learning:
|
||||
|
||||
- **Online Platforms**: FreeCodeCamp, Codecademy, W3Schools
|
||||
- **Books**: "HTML & CSS: Design and Build Web Sites" by Jon Duckett, "Sass for Web Designers" by Dan Cederholm
|
||||
- **Courses**: Coursera, Udemy, Pluralsight
|
||||
|
||||
Remember, the best way to learn is by doing. Start building your web projects today!
|
||||
|
||||
---
|
||||
|
||||
## **Web Development Glossary**
|
||||
|
||||
To aid in your learning process, we have compiled a glossary of common terms and concepts used in web development and in this guide.
|
||||
|
||||
### **HTML**
|
||||
|
||||
(Here, maintain the definitions as they were in your original glossary, adding definitions for "Responsive Design" and "SEO" in appropriate sections)
|
||||
|
||||
---
|
||||
|
||||
### **Self-closing HTML tags**
|
||||
|
||||
Self-closing HTML tags, also known as void elements, do not have a closing tag as they cannot have any content within them. Here is a list of self-closing tags:
|
||||
|
||||
- `<area>`
|
||||
- `<base>`
|
||||
- `<br>`
|
||||
- `<col>`
|
||||
- `<embed>`
|
||||
- `<hr>`
|
||||
- `<img>`
|
||||
- `<input>`
|
||||
- `<link>`
|
||||
- `<meta>`
|
||||
- `<param>`
|
||||
- `<source>`
|
||||
|
||||
---
|
||||
|
||||
### **Feedback and Questions**
|
||||
|
||||
We welcome your feedback and questions on this guide. Feel free to reach out with any doubts or suggestions as you navigate through the exciting path of web development. Happy learning!
|
||||
|
||||
## Web Development Glossary
|
||||
|
||||
This glossary provides definitions for common terms and concepts used in web development and in this guide. Understanding these terms will aid in grasping the various topics covered in the main guide.
|
||||
|
||||
### **Mid to Expert Level Webdev Terms**
|
||||
|
||||
#### **API**
|
||||
|
||||
Application Programming Interface: A set of definitions and protocols that act as an intermediary between two software programs. APIs enable different software applications to communicate with one another and exchange data.
|
||||
|
||||
#### **Authentication**
|
||||
|
||||
The process of verifying the identity of a user. This can be done through methods such as usernames and passwords, two-factor authentication, or OAuth.
|
||||
|
||||
#### **Authorization**
|
||||
|
||||
The process of granting users access to specific resources or functionality. This is typically done based on the user's role or permissions.
|
||||
|
||||
#### **Caching**
|
||||
|
||||
The process of storing frequently accessed data in a temporary location so that it can be retrieved quickly and efficiently. Caching can be used to improve the performance of web applications and reduce bandwidth consumption.
|
||||
|
||||
#### **Cloud Computing**
|
||||
|
||||
The delivery of computing services—including servers, storage, databases, networking, software, analytics, intelligence, and the Internet of Things (IoT)—over the internet ("the cloud") to offer faster innovation, flexible resources, and economies of scale.
|
||||
|
||||
#### **Continuous Integration/Continuous Delivery (CI/CD)**
|
||||
|
||||
A set of practices that automates the building, testing, and deployment of software. CI/CD allows for faster and more reliable software releases.
|
||||
|
||||
#### **Content Delivery Network (CDN)**
|
||||
|
||||
A network of servers distributed around the world that deliver content to users based on their geographic location. CDNs can be used to improve the performance and reliability of web applications by serving content from the server that is closest to the user.
|
||||
|
||||
#### **Database**
|
||||
|
||||
A structured collection of data that is organized and stored in a way that makes it easy to retrieve and manage. Databases are used to power a wide variety of web applications, from social networks to e-commerce websites.
|
||||
|
||||
#### **Deployment**
|
||||
|
||||
The process of making a web application available to users. This typically involves uploading the application files to a web server and configuring the server to serve the application.
|
||||
|
||||
#### **Domain Name System (DNS)**
|
||||
|
||||
The system that translates domain names (e.g., google.com) into IP addresses (e.g., 172.217.9.110). DNS is essential for the operation of the web.
|
||||
|
||||
#### **Frontend Development**
|
||||
|
||||
The development of the user-facing part of a web application. This includes the HTML, CSS, and JavaScript code that is used to create the web pages and interact with the user.
|
||||
|
||||
#### **Backend Development**
|
||||
|
||||
The development of the server-side part of a web application. This includes the code that is responsible for handling user requests, processing data, and generating responses.
|
||||
|
||||
#### **Framework**
|
||||
|
||||
A collection of pre-written code and libraries that provide a foundation for building web applications. Frameworks can help to simplify and streamline the development process.
|
||||
|
||||
#### **JavaScript**
|
||||
|
||||
A programming language that is used to add interactivity and dynamic behavior to web pages. JavaScript is one of the core technologies of the web, and it is used in a wide variety of web applications.
|
||||
|
||||
#### **JSON**
|
||||
|
||||
JavaScript Object Notation: A lightweight data-interchange format that is commonly used to exchange data between web applications and servers.
|
||||
|
||||
#### **Node.js**
|
||||
|
||||
A JavaScript runtime environment that allows JavaScript to be used outside of the browser. Node.js is commonly used to develop backend web applications.
|
||||
|
||||
#### **Performance Optimization**
|
||||
|
||||
The process of improving the performance of a web application by reducing its load time and memory usage. Performance optimization is important for ensuring that web applications are responsive and provide a good user experience.
|
||||
|
||||
#### **REST**
|
||||
|
||||
Representational State Transfer: A software architectural style that specifies how to design web services. RESTful web services are easy to understand and use, and they are widely supported by a variety of programming languages and frameworks.
|
||||
|
||||
#### **Scalability**
|
||||
|
||||
The ability of a web application to handle increased traffic and workload without sacrificing performance or reliability. Scalability is important for web applications that need to be able to handle large numbers of users.
|
||||
|
||||
#### **Security**
|
||||
|
||||
The practice of protecting web applications from unauthorized access, use, disclosure, disruption, modification, or destruction. Security is essential for protecting the privacy and security of users' data.
|
||||
|
||||
### **Conclusion**
|
||||
|
||||
This glossary provides a starting point for learning about the common terms and concepts used in web development. As you continue to learn and grow as a web developer, you will encounter many other terms and concepts. It is important to stay up-to-date on the latest technologies and trends in web development.
|
||||
90
tech_docs/webdev/css.md
Normal file
90
tech_docs/webdev/css.md
Normal file
@@ -0,0 +1,90 @@
|
||||
# Best Practices for CSS with Bootstrap, Tailwind, and Other Tools
|
||||
|
||||
## General CSS Best Practices
|
||||
|
||||
- **Modularity:** Organize CSS into modular files to improve readability and maintainability.
|
||||
- **Descriptive Class Names:** Use clear and self-explanatory class names such as `.main-button` over ambiguous ones like `btn1`.
|
||||
- **Avoid Inline Styles:** Rely on external stylesheets over inline styles for a more organized and reusable CSS.
|
||||
- **Use Variables:** Adopt CSS Custom Properties to maintain consistent design elements and ease modifications.
|
||||
- **Specificity Balance:** Avoid overly specific or too generic selectors to ensure ease of styling and overriding.
|
||||
- **Consistent Formatting:** Adhere to a uniform convention for indentation, selector naming, and property order.
|
||||
- **Responsive Design:** Adopt a mobile-first design approach and ensure adaptability across various devices.
|
||||
- **Performance:** Optimize CSS to minimize browser reflows or repaints, ensuring a smooth user experience.
|
||||
|
||||
### Expanding Your CSS Toolkit
|
||||
|
||||
- **CSS Preprocessors:** Consider leveraging preprocessors like Sass or LESS for advanced features.
|
||||
- **CSS Linters:** Incorporate tools like Stylelint to identify and rectify stylistic or functional issues in your CSS.
|
||||
- **CSS Style Guides:** Adopt or define a style guide to maintain consistent CSS styling across projects.
|
||||
|
||||
## Integrating Bootstrap
|
||||
|
||||
### Getting Started with Bootstrap
|
||||
|
||||
- **Bootstrap Components:** Utilize built-in components for design consistency.
|
||||
- **Customizing Bootstrap:** Override default styles with your custom styles to maintain brand consistency.
|
||||
- **Sass with Bootstrap:** Use Sass for deeper customization of Bootstrap components.
|
||||
- **Lint Your CSS:** Incorporate CSS linters to detect and rectify potential issues in your styles.
|
||||
|
||||
### Example Usage with Bootstrap
|
||||
|
||||
```css
|
||||
@import "~bootstrap/scss/bootstrap";
|
||||
$primary-color: #007bff;
|
||||
body {
|
||||
background-color: $primary-color;
|
||||
}
|
||||
.custom-button {
|
||||
background-color: $primary-color;
|
||||
color: white;
|
||||
}
|
||||
```
|
||||
|
||||
## Navigating Tailwind CSS
|
||||
|
||||
### Dive into Tailwind
|
||||
|
||||
- **Utility-First:** Embrace the utility-first paradigm by combining small utility classes directly in the markup.
|
||||
- **Customizable:** Personalize Tailwind's design tokens to your needs via its configuration file.
|
||||
- **Responsiveness:** Use utility prefixes for varying responsive designs.
|
||||
- **PurgeCSS:** Utilize PurgeCSS to optimize the final CSS build size by removing unused styles.
|
||||
|
||||
### Example Usage with Tailwind
|
||||
|
||||
```html
|
||||
<div class="bg-blue-500 text-white p-6 rounded-lg shadow-md">
|
||||
<h1 class="text-2xl font-bold mb-4">Tailwind Example</h1>
|
||||
<p>Demonstration of the utility-first design approach with Tailwind CSS.</p>
|
||||
</div>
|
||||
```
|
||||
|
||||
## Bootstrap vs Tailwind CSS
|
||||
|
||||
### Philosophy
|
||||
|
||||
- **Bootstrap:** Primarily component-based, offering ready-to-use UI elements.
|
||||
- **Tailwind CSS:** Adopts a utility-first approach, allowing granular control over styles.
|
||||
|
||||
### Customization
|
||||
|
||||
- **Bootstrap:** Customize by overriding Sass variables and mixins.
|
||||
- **Tailwind CSS:** Personalize styles via the Tailwind configuration file.
|
||||
|
||||
### Learning Curve
|
||||
|
||||
- **Bootstrap:** Generally considered beginner-friendly with its comprehensive documentation.
|
||||
- **Tailwind CSS:** Can initially feel counterintuitive, especially for those new to the utility-first approach, but becomes intuitive with practice.
|
||||
|
||||
### Performance
|
||||
|
||||
- **Bootstrap:** Potentially contains redundant styles which may not be used in every project.
|
||||
- **Tailwind CSS:** Initially has a large file size but optimizes significantly with tools like PurgeCSS.
|
||||
|
||||
### Community
|
||||
|
||||
- **Bootstrap:** Boasts a vast and established community.
|
||||
- **Tailwind CSS:** Rapidly growing in popularity with an active community.
|
||||
|
||||
## Final Thoughts
|
||||
|
||||
Both Bootstrap and Tailwind CSS offer unique strengths. Your choice between them should be based on the specific requirements of your project and your familiarity with each tool. Employing best practices in CSS, regardless of the tool chosen, is imperative for creating responsive and elegant designs.
|
||||
194
tech_docs/webdev/html_css_standards.md
Normal file
194
tech_docs/webdev/html_css_standards.md
Normal file
@@ -0,0 +1,194 @@
|
||||
# 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
|
||||
|
||||
- `.btn`:
|
||||
- **Description**: Used to style generic buttons.
|
||||
- **Example**: `<button class="btn">Click Me</button>`
|
||||
- `.btn--large`:
|
||||
- **Description**: Styles large buttons.
|
||||
- **Example**: `<button class="btn btn--large">Large Button</button>`
|
||||
- `.btn--small`:
|
||||
- **Description**: Styles small buttons.
|
||||
- **Example**: `<button class="btn btn--small">Small Button</button>`
|
||||
|
||||
## Layout
|
||||
|
||||
- `.container`:
|
||||
- **Description**: Wraps the main content of a web page, centering the content and limiting its width.
|
||||
- **Example**: `<div class="container">...</div>`
|
||||
- `.row`:
|
||||
- **Description**: Creates horizontal rows of elements.
|
||||
- **Example**: `<div class="row">...</div>`
|
||||
- `.col`:
|
||||
- **Description**: Divides a `.row` into vertical columns. Width is often defined by additional classes or styles.
|
||||
- **Example**: `<div class="col">...</div>`
|
||||
|
||||
## Sections
|
||||
|
||||
- `.header`:
|
||||
- **Description**: Styles the top section of a web page, including the navigation bar and logo.
|
||||
- **Example**: `<header class="header">...</header>`
|
||||
- `.main`:
|
||||
- **Description**: Styles the main content area of a web page.
|
||||
- **Example**: `<main class="main">...</main>`
|
||||
- `.footer`:
|
||||
- **Description**: Styles the footer of a web page.
|
||||
- **Example**: `<footer class="footer">...</footer>`
|
||||
|
||||
## Forms
|
||||
|
||||
- `.form`:
|
||||
- **Description**: Styles the entirety of forms.
|
||||
- **Example**: `<form class="form">...</form>`
|
||||
- `.input`:
|
||||
- **Description**: Can style multiple form elements. Specific classes should be used for distinct input types.
|
||||
- **Example**: `<input type="text" class="input">`
|
||||
- `.text`, `.password`, `.checkbox`, `.radio`:
|
||||
- **Description**: Styles individual types of inputs.
|
||||
- **Examples**:
|
||||
- Text: `<input type="text" class="text">`
|
||||
- Password: `<input type="password" class="password">`
|
||||
- Checkbox: `<input type="checkbox" class="checkbox">`
|
||||
- Radio: `<input type="radio" class="radio">`
|
||||
|
||||
## Tables
|
||||
|
||||
- `.table`:
|
||||
- **Description**: Used to style tables of data.
|
||||
- **Example**: `<table class="table">...</table>`
|
||||
|
||||
## Images
|
||||
|
||||
- `.image`:
|
||||
- **Description**: Styles generic images.
|
||||
|
||||
# Usage of Inline and Block Elements
|
||||
|
||||
Understanding the difference between inline and block elements is pivotal for structuring and styling web content effectively.
|
||||
|
||||
## Inline 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 (`<a>`):** Hyperlinks to another resource.
|
||||
- **Usage**: `<a href="https://example.com">Visit Example</a>`
|
||||
- **Images (`<img>`):** Embeds an image.
|
||||
- **Usage**: `<img src="path/to/image.jpg" alt="Description">`
|
||||
- **Strong Emphasis (`<strong>`):** Denotes strong importance, typically displayed as bold.
|
||||
- **Usage**: `<strong>Important text.</strong>`
|
||||
- **Emphasis (`<em>`):** Gives emphasized text, usually rendered as italic.
|
||||
- **Usage**: `<em>Emphasized text.</em>`
|
||||
- **Code (`<code>`):** Designates a single line of code.
|
||||
- **Usage**: `<code>let x = 10;</code>`
|
||||
- **Span (`<span>`):** Generic inline container for phrasing content. Doesn't convey any meaning on its own.
|
||||
- **Usage**: `<span class="highlight">Highlighted text</span>`
|
||||
- **Abbreviations (`<abbr>`):** Represents an abbreviation or acronym.
|
||||
- **Usage**: `<abbr title="HyperText Markup Language">HTML</abbr>`
|
||||
- **Inline Quotation (`<q>`):** Denotes a short inline quotation.
|
||||
- **Usage**: `<q>Cogito, ergo sum</q>`
|
||||
|
||||
## Block Elements
|
||||
|
||||
Block elements start on a new line and typically take up the full width of their parent container.
|
||||
|
||||
Examples include:
|
||||
|
||||
- **Paragraphs (`<p>`):** Denotes a block of text.
|
||||
- **Usage**: `<p>This is a paragraph.</p>`
|
||||
- **Headings (`<h1>` to `<h6>`):** Mark section headings, with `<h1>` being the most prominent and `<h6>` the least.
|
||||
- **Usage**:
|
||||
- `<h1>Main Title</h1>`
|
||||
- `<h2>Subheading</h2>`
|
||||
- ...
|
||||
- `<h6>Smallest Subheading</h6>`
|
||||
- **Lists:**
|
||||
- **Unordered (`<ul>`):** List without a specific order.
|
||||
- **Usage**:
|
||||
```html
|
||||
<ul>
|
||||
<li>Apple</li>
|
||||
<li>Banana</li>
|
||||
</ul>
|
||||
```
|
||||
- **Ordered (`<ol>`):** Numbered list.
|
||||
- **Usage**:
|
||||
```html
|
||||
<ol>
|
||||
<li>First item</li>
|
||||
<li>Second item</li>
|
||||
</ol>
|
||||
```
|
||||
- **Description (`<dl>`):** List of terms with their descriptions.
|
||||
- **Usage**:
|
||||
```html
|
||||
<dl>
|
||||
<dt>Browser</dt>
|
||||
<dd>A software used to access the web.</dd>
|
||||
</dl>
|
||||
```
|
||||
- **Divisions (`<div>`):** Generic container that groups content.
|
||||
- **Usage**: `<div class="section">...</div>`
|
||||
- **Block Quotation (`<blockquote>`):** Represents a section quoted from another source.
|
||||
- **Usage**:
|
||||
```html
|
||||
<blockquote cite="sourceURL">
|
||||
This is a block quote from another source.
|
||||
</blockquote>
|
||||
```
|
||||
- **Tables (`<table>`):** Represents tabular data.
|
||||
- **Usage**:
|
||||
```html
|
||||
<table>
|
||||
<tr>
|
||||
<th>Header 1</th>
|
||||
<th>Header 2</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Data 1</td>
|
||||
<td>Data 2</td>
|
||||
</tr>
|
||||
</table>
|
||||
```
|
||||
- **Forms (`<form>`):** Represents an interactive form.
|
||||
- **Usage**:
|
||||
```html
|
||||
<form action="/submit">
|
||||
<input type="text" name="name">
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
```
|
||||
- **Preformatted Text (`<pre>`):** Displays text with whitespace preserved, often used with `<code>`.
|
||||
- **Usage**:
|
||||
```html
|
||||
<pre>
|
||||
function hello() {
|
||||
console.log("Hello, world!");
|
||||
}
|
||||
</pre>
|
||||
```
|
||||
- **Figures (`<figure>` and `<figcaption>`):** Used to mark up a photo or graphic with an optional caption.
|
||||
- **Usage**:
|
||||
```html
|
||||
<figure>
|
||||
<img src="path/to/image.jpg" alt="Description">
|
||||
<figcaption>Caption for the image.</figcaption>
|
||||
</figure>
|
||||
```
|
||||
|
||||
## Conclusion
|
||||
|
||||
Choosing the correct element—whether inline or block—enhances the semantic value of the content, improves accessibility, and makes styling more straightforward.
|
||||
|
||||
- **Example**: `<img src="path/to/image.jpg" class="image" alt="Description">`
|
||||
- `.img-responsive`:
|
||||
- **Description**: Ensures images are responsive and adjust to their container's width.
|
||||
- **Example**: `<img src="path/to/image.jpg" class="img-responsive" alt="Description">`
|
||||
|
||||
## Conclusion
|
||||
By adhering to these naming conventions and standards, we ensure that our code remains consistent across projects, making it easier for developers to collaborate, maintain, and extend the codebase.
|
||||
Reference in New Issue
Block a user