DEV Community


Posted on

Ultimate HTML and CSS guide

What is HTML?

HTML which is hypertext markup language is the standard markup language for building websites. It defines the basic structures of the web pages. It uses tags and attributes to tell the browser how to both process text and present it to the viewer.

HTML can help you specify different parts of a document including title, list, image and headers.

Is HTML a programming language?

HTML is a markup language and not a programming language although there are many ongoing debates regarding this topic.

The main description of HTML as not a programing language is: Programming languages have a functional purpose such as declaring variables, modifying data or, evaluating expressions. These instructions directs computer on what to do and how to do it.

HTML, on the other hand, doesn’t execute any function. It simply gives the browser the content to display and it doesn’t care about how HTML will go ahead and display the content. Thus HTML doesn’t have a functional purposelessly but a structural purpose.

What is HTML used for?

The primary use of HTML is to create web pages. HTML is free to use because it’s an open-source and is supported by all modern browsers and ensures your elements such as text and images are displayed.

HTML enables one to format documents with elements such as headings, paragraphs and lists. You can also embed audio files, videos and images. HTML enables one to and hyperlinks for other websites thus allowing one to jump and navigate from one web page to another.

Thus, HTML can help you design a basic web page that you can add Cascading Style Sheets (CSS) or JavaScripts.

Other than webpages, HTML can be used to create other things such as tables for organizing data, forms for collecting user information, placing an order and processing transactions.

How to Write HTML

HTML consists of tags and attributes. An Element consists of a start tag, attribute, value, content and end tag.


Most elements have an opening and closing tag. The opening tags precede the text and contain element name enclosed in brackets i.e. “<” and “<”. The closing tags are identical to opening tags just that the closing tags have a backward slash before the element name. For example for a paragraph tag it’ll be


Other tags present include heading, structure, self-closing and others.

HTML Attributes

Attributes aren’t necessarily for all HTML elements unlike tags. Attributes provides additional information on the HTML element. For example an image element must have a source attribute.

How to Create an HTML File

First create an HTML file. It should contain all the HTML for your web page and it’ll be uploaded to your web server.

You can use basic text editors such as Notepad++ to create and edit your file.

Steps to follow:

Declare the type of the document as HTML using a special code <!DOCTYPE html> in the first line of the file.

On the next line add an opening tag and below it, add a closing tag.

Add a tag and a between and in your document. You can how go ahead and add other HTML tags such as paragraph, heading and style tags.

Adding CSS to HTML

CSS helps customize your layouts and styling by changing font, color and alignment of the elements.

You can add CSS to HTML documents in the following ways:
  • Inline- use of style attribute inside HTML elements
  • Internal-use a element in the <head> section</li> <li>External- by using a <link> element to link to an external CSS file</li> </ul>

Top comments (0)