Jump to content

Recommended Posts

The first thing you can learn HTML, whether you want to become a professional web developer or just want to learn more about how websites work. The basic language for developing web pages and web applications is HTML. A server sends an HTML file to your computer every time you visit a website, and your browser interprets and displays the information contained in the file.

What is HTML?

HTML stands for Hyper Text Markup Language, which for many beginners is a confusing concept. The best way to understand HTML is to explain the meanings of each word. Hyper Text is a type of text that contains hyperlinks to other texts. Hypertext is used every time you click on a highlighted or underlined link that takes you to another page. A “web” of pages begins to form as more and more pages use hypertext to connect to one another. This is where the name “World Wide Web” comes from.

Markup refers to the special symbols or codes inserted into a document to tell the web browser how to display the document data. Markup code, for example, will tell the browser to show a phrase in bold or italic text, or which sections of the document are headings and which are paragraphs. Markup code is used for a variety of languages, including HTML.

Language refers to the concept of a standardised code. When writing HTML, everybody must obey those guidelines, much as when speaking a normal language. This is so that the code can be understood and interpreted by all browsers. There are numerous programming languages, and you may be familiar with some of the more common ones, such as Java, Python, and Ruby.

HTML Tags

You might remember that the use of angle brackets was the most prominent feature of HTML code. The angle brackets (and the code they contain) are known as tags. Tags are used to separate HTML code from standard text. The browser will not show any text written inside the angle brackets. The text inside the angle brackets is generally used to inform the browser about how to display or convert standard text between the opening (also known as the start) and closing tags (also called the end tag).

Tags are usually found in pairs, and the difference between an opening tag and a closing tag is that a closing tag’s first symbol inside the brackets is a slash “/” symbol.

For example, a pair of h1 tags (used to define heading text), with some content in between.

<h1>content.</h1>

In this example, the <h1> is the opening tag and the </h1> is the closing tag.

How To Use Tags

Here’s an example of how tags can be used to transform text.

If we add the sentence “Some text.” to our HTML file, it will simply display as regular text, as shown below:

Some text.

If we want the sentence to be bold, we can use the <b> opening tag before the text and the </b> closing tag after the text. The letter “b” stands for “bold” in the tag.

If we add <b>Some text.</b> to our HTML file, it will look like this:

Some text.

We may use an <i> opening tag before the text and </i> closing tag after the text to make the sentence appear in italic text. The “i” stands for “italic,” as you might have guessed.

If we add <i>Some text.</i> to our HTML file, it will look like this:

Some text.

We can add an <a href=“www.google.com”> opening tag before the text and a </a> closing tag after the text if we want the sentence to be shown as a hyperlink. Can you figure out what the letter “a” stands for? This one is a bit more difficult… it stands for “anchor.”

If we add <a href=“www.google.com”>Some text.</a> to our HTML file, it will look like this:

Some text.

This hyperlink will take us to a different webpage if we click on it. You can possibly guess which page this text links to if you look at the code.

These three examples in to a simple HTML document:

<!DOCTYPE html>

<html>

<head>

<title>Page Title</title>

</head>

<body>

<b>Some text.</b>

<i>Some text.</i>

<a href=”www.google.com”>Some text.</a>

</body>

</html>

If you save this file and open it in a browser, it should look like this:

Some text. Some text. Some text.

 

Two Important Rules For Using Tags

There are two main rules you need to follow when using tags. You must always use angle brackets for tags. In other programming languages, square and round brackets are used for other purposes. The browser will not understand your HTML code if you use square or round brackets.

Tags almost always come in pairs. This means that you must always close a tag after opening it, except a few special examples. If you forget to add a closing tag the element you’re attempting to transform will not show properly. In the worst-case scenario, forgetting to close a tag could result in your page crashing.

 

Untitled-design-1-629x420.jpg

Edited by PHP Support
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...