Chapter 2 - CSS Basics
Chapter 2 - CSS Basics
❖ Introduction :
❖ Tools of CSS :
● Visual Studio Code: A popular and versatile text editor with built-in support
for CSS, including syntax highlighting, code completion, and debugging.
● Sublime Text: Another lightweight and highly customizable text editor used
by many developers for CSS and other web development tasks.
CSS Preprocessors:
CSS Frameworks:
● CSS Minifiers: Tools like cssnano and uglifycss minify CSS files by
removing unnecessary whitespace, comments, and optimising the code for
faster loading times.
● Prefixing Tools: Autoprefixer (autoprefixer.github.io) automatically
adds vendor prefixes to CSS rules based on browser support, ensuring
compatibility across different browsers.
● Every modern web browser (Chrome, Firefox, Safari, Edge, etc.) includes
built-in developer tools that allow developers to inspect and debug CSS styles
applied to web pages, modify styles in real-time, analyse performance, and
more.
● W3C CSS Validator: A tool provided by the World Wide Web Consortium
(W3C) that checks CSS code for syntax errors and ensures it follows CSS
standards (jigsaw.w3.org/css-validator/).
❖ Properties of CSS :
● Typography
● Colours and Backgrounds
● Box Model
● Positioning
● Flexbox and Grid Layout
● Text and Typography
● Animation and Transitions
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Subscribe Button</title>
</head>
<body>
<button class="subscribe-btn">Subscribe</button>
</body>
</html>
CSS (STYLES.CSS)
/* Basic styling */
body {
display: flex;
justify-content: center;
height: 100vh;
margin: 0;
.subscribe-btn {
border: none;
color: white;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
cursor: pointer;
border-radius: 4px;
.subscribe-btn:hover {
➔ HTML:
We have a simple button element with a class subscribe-btn.
➔ CSS:
The .subscribe-btn class styles the button:
➔ Usage:
● Copy the HTML into an .html file and the CSS into a .css file (or
embed within <style> tags in the HTML <head>).
● Adjust the styles (colors, sizes, etc.) as needed to fit your design
preferences.
● This basic example can be enhanced with additional CSS for more
complex designs or animations.