HTML (HyperText Markup Language) and CSS (Cascading Style Sheets) are two fundamental technologies used to create and design web pages.
- HTML (HyperText Markup Language):
- HTML is the standard markup language for creating web pages.
- It provides the structure of a web page by using a system of elements and tags to define different parts of content like headings, paragraphs, lists, links, images, etc.
- HTML elements are represented by tags enclosed in angle brackets (
<tag>
), with content between the opening and closing tags. - Example:
<p>This is a paragraph.</p>
,<h1>This is a heading</h1>
,<img src="image.jpg" alt="Image description">
.
- CSS (Cascading Style Sheets):
- CSS is a style sheet language used for describing the presentation of a document written in HTML.
- It allows you to control the appearance of HTML elements by defining styles such as colors, fonts, layouts, and more.
- CSS works by targeting HTML elements and applying styling rules to them.
- CSS rules consist of a selector (which targets the HTML element) and one or more declarations (which define the style properties and their values).
- Example:
p { color: blue; font-size: 16px; }
In this example,p
is the selector targeting all<p>
elements, and the declarations inside the curly braces define that paragraphs should have blue color text and a font size of 16 pixels.
Together, HTML and CSS form the basic building blocks of web pages. HTML provides the structure and content of a webpage, while CSS provides the styling and presentation. They often work together, with HTML defining the elements and CSS controlling how those elements are displayed.