What Is Markup Language? Examples, Types & Definition

Samy Ben Sadok

Sep 18, 202310 min read
hand writing markup language on a web browser
Share

TABLE OF CONTENTS

What Is a Markup Language?

A markup language is a set of rules that defines how the layout and presentation of text and images should appear in a digital document. It allows structuring documents, adding formatting, and specifying how different elements should be displayed (or “rendered”) on webpages.

This structuring helps search engines like Google understand the information on websites better. If search engines know more about what a page is about, they are more likely to show it to people who are looking for its content. Which, in result, can bring more people to websites with the right markup.

An example of a markup language—and the one most people know—is HTML. And it looks like this:

<b>Example of a Markup Language</b>

On a webpage, that’ll look like this:

Example of a Markup Language on a webpage

Some other markup language examples include:

But we’ll get into those later.

For now, note that markup languages are different from programming languages.

Programming languages are used to create functional and dynamic web applications.

Markup languages focus primarily on the presentation and structure of content. They are static and don’t use logic or algorithms.

To give you an even better idea of what markup languages are, let’s look closer at two categories of markup languages: semantic and presentational markup.

Semantic Markup

Semantic markup, also known as semantic HTML, defines sections of a webpage to help browsers, search engines, and developers better understand the content of that webpage.

Here’s a simple illustration to show you what that means:

An illustration of what a semantic HTML is

While the non-semantic <div> and <span> tags work for formatting, semantic tags like <article>, <section>, and <nav> define each element on your webpage.

In other words, semantic markup adds a layer of information that makes it easier for search engines and other relevant parties to understand your content.

Pro tip: Already using semantic markup but still don’t see SEO results? Maybe there’s a problem. Find out with Semrush’s Site Audit tool:

Enter your domain into the tool and configure your crawl settings.

Semrush’s Site Audit tool search bar

Go to the “Issues” tab.

"Issues" tab in Site Audit tool

And search “tag” in the search box.

Search for "tag" in Issues tab of Site Audit tool

Click on “Why and how to fix it” to learn more about each site issue.

An example of “Why and how to fix it” section

Presentational Markup

Presentational markup focuses on the content’s appearance, including font size, color, alignment, and other visual styles.

With HTML, presentational markup was commonly used in earlier versions to define the layout and design of webpages directly within the code.

Tags like <b> for bold text, <i> for italicized text, and <font> to specify font properties are good examples of presentational markup.

Nowadays, presentational markup is generally discouraged in favor of separating content and presentation. Separating content and presentation allows for better organization. It makes it easier to update the design without affecting the information. And vice versa. 

3 Benefits of Using Markup Languages

Using markup languages on your website has many advantages. Here are three to keep in mind:

1. They Improve SEO

Tags tell browsers more about the content on your page.

See tags as landmarks on a map. They pinpoint crucial spots, helping search engines navigate and comprehend your content's structure and meaning. 

Here’s one way that works.

When you skim a book or website, you look at the names and subtitles to figure out what the main point is.

Similarly, search engines use heading tags—like the <h1>, <h2>, and <h3>—as signposts. These headings make content easily digestible for readers. And tell search engines about the hierarchy of your information.

And then there’s semantic markup. Using semantic markup tags is your way of speaking the search engines’ language. And adding a layer of information and context to your documents. 

Take the <main> tag, for example. It specifies a document’s primary content. Everything within the <main> element should be unique to that document, omitting recurrent content such as sidebars or navigation links.

And then, we’ve got the <aside> tag. This tag is used for content that is related but distinct from the main content. Search engines recognize it as supplementary material. Often, website sidebars are contained within the <aside> tag.

2. They Create Consistent Layouts

Markup languages serve as a uniting force, allowing for consistent layouts across multiple platforms.

How? 

They define the structure and content of a document in a universally understood way. This method ensures that your content appears the same to everyone, regardless of the technology they're using.

Webpage layout in different formats, including iPhone 13, tablet and laptop/desktop

This uniform rendering goes beyond improved aesthetics; it provides a user-friendly experience and seamless navigation. 

Markup language allowed developers to create templates—predefined structures with placeholder content. Users could then replace these placeholders with their content by simply filling in the blanks.

3. They Enhance Accessibility

Web accessibility enables people with disabilities to access and interact with your website. Markup languages excel in this area because they use semantic tags to add meaning on top of the content structure.

Markup languages can be interpreted by assistive technologies such as screen readers, bridging the gap between content and those who need to access it differently.

Making websites more accessible helps ensure that your digital world is welcoming. Proper markup not only helps you adhere to some legal and ethical guidelines related to accessibility but also embodies a commitment to reaching every potential user.

How Markup Languages Work

Understanding the workings of markup languages is less complex than it may initially sound.

Tags and Elements

A markup tag tells browsers how it should display content. Or defines what that piece of content is.

For example, this is what an HTML tag looks like.

<b>

That tag indicates that the content should be bolded.

Tags are usually enclosed in opening and closing brackets. And come in pairs—an opening tag and a closing tag.

Here’s what that looks like:

<b></b>

An element consists of the tag and the content that the tag defines.

For example, this is an element:

<b>This is an element</b>

And here's what that will look like on a webpage:

"<b>This is an element</b>" on a webpage

When a program, like a web browser, encounters a document with markup tags, it interprets them as cues for presenting the content.

For instance, in HTML, tags such as <h1> to <h6> and <p> define headings and paragraphs, respectively. 

These tags tell browsers two things:

  • How the text should appear: <h1> is typically bigger and more emphasized than <h6>. Which is more emphasized than <p>.
  • The structure of the content: The <h1> tag represents the main concept or idea of a page. While you can use <h2> to <h6> tags to structure your content into subtopics.

Attributes

HTML elements include attributes. Attributes are extra values used to set an element’s characteristics or modify its behavior in different ways to meet your requirements. 

Take a popular HTML tag like <a>. We use it to create links and can add several attributes to customize its behavior.

A basic example of a link to Semrush’s homepage would look like this:

A basic example of a link to Semrush’s homepage

Let's say you want to force the link to open in a new tab. 

Simply add another attribute—"target”—to specify your instruction.

A basic example of a link to Semrush’s homepage with target specified

Now, when someone clicks on that link, it’ll open in a new tab.

HTML, XML, SGML, and XHTML are the most common among the various markup languages available.

HTML: The Web Backbone

HyperText Markup Language (HTML) is the most popular markup language. Web developers use it to structure content on the web, including headings, paragraphs, images, links, and more.

HTML also provides the foundational structure upon which everything else is built. While HTML lays out the content, additional languages like Cascading Style Sheets (CSS) and JavaScript (JS) can be used on top to polish the appearance and dictate how elements interact.

HTML’s ongoing development continues to be a critical part of modern web development. Its accessibility and adaptability make it an essential tool for anyone involved in creating content for the web. 

Why?

Because HTML is adapting to modern demands and ensuring content remains accessible across varying devices and platforms.

With over 100 HTML tags available, it might be difficult to remember them all. We’ve listed the most important HTML tags to help you get started.

XML: Bridging Data Storage and Transport

Extensible Markup Language (XML) was designed for storing and transporting data.

It doesn’t use pre-defined tags. Instead, it allows users to create their own tags customized to unique user requirements, making it a highly versatile and adaptable markup language. 

For example, you could easily use XML to describe a recipe. Here’s one example for a fruit salad recipe.

A fruit salad recipe described in XML

Here’s a breakdown of what this code means:

<?xml version="1.0" encoding="UTF-8"?>: This is the XML declaration. It defines the XML version and the character encoding used in the document.

<!DOCTYPE ... >: This is the Document Type Definition (DTD). It defines the structure and the legal elements and attributes of the XML document. In this case, it specifies the structure and elements that can be used in our recipe.

  • <recipe> contains the entire fruit salad recipe.
  • <name> tells you the name of the dish.
  • <ingredients> lists all the items you need.
  • <steps> provides a sequential guide on how to prepare the fruit salad.

Any SEO applications? Yes—XML is a powerful ally for your website’s visibility.

It’s popular because you can use it to create an XML sitemap, which helps search engines better scan your site by laying out the URLs you want indexed.

In this XML sitemap example, the document lists URLs on a website and metadata like the last modified date, change frequency, and priority:

XML sitemap example

Search engines can use this data to determine how often to crawl each page and its relative importance compared to other site pages.

It’s worth noting that Google ignores the <changefreq> and <priority> tags.

The <lastmod> tag can be used, but only if it can be relied upon to be correct (for example, if the dates in your sitemap don't seem to match up, Google may stop trusting it).

Pro tip: Create your XML sitemap and submit it via Google Search Console. It will help Google discover and index your content website faster.

SGML: The Precursor to HTML and XML

SGML is a framework for creating customized markup languages tailored to specific needs.

To start with SGML, you first craft a Document Type Definition (DTD). The DTD outlines the structure, sets the boundaries, and lists the elements, attributes, and entities you can use in your document.

To create an email in SGML, you may, for instance, write the following code:

An example of a code for creating an email in SGML

You may now write your document according to the established guidelines, marking up the text with the components and characteristics you've set.

An example of an email in SGML

That being said, SGML is now less relevant.

HTML and XML are more user-friendly and widely supported. So most developers prefer those languages over SGML.

XHTML: Bridging HTML and XML with Strict Standards

XHTML is a hybrid between HTML and XML, essentially combining the presentation capabilities of HTML with the strict syntax rules of XML. 

As the first step toward a more organized and consistent web, XHTML was developed to improve code and browser compatibility. 

The birth of HTML5 changed things. HTML5 addresses many of XHTML’s benefits and adds cutting-edge web features. Most developers now use HTML5 over XHTML due to its adaptability and ability to keep up with the constantly evolving digital landscape, 

One of the critical advantages of XHTML is its adherence to XML rules, which helps ensure consistency in the markup. 

Bonus: Honorable Mentions

Beyond the headliners, there’s a backstage full of lesser-known yet compelling languages that deserve mention.

  • Scalable Vector Graphics (SVG): Allows images to be resized without losing quality, perfect for crisp graphics on the web
  • TeX: Used for making math and technical papers look neat and professional
  • LaTeX: An enhancement of TeX, making it even easier to create well-structured documents, especially for researchers
  • MathML: Designed to show math equations and formulas on the web

How to Learn Markup Languages

Ready to give markup languages a try? Here are the best ways to get started.

Online Tutorials

Online tutorials are a great starting point, especially if you’re a beginner. You can find comprehensive online tutorials for all the best markup languages at sites like the W3Schools and the Mozilla Developer Network

W3Schools HTML tutorial

They offer structured learning materials covering markup languages' basics, including syntax, tags, and attributes. 

One of the best features? You can practice writing code and see the results in real time through interactive examples and exercises. 

These tutorials often include quizzes and assessments at the end of each chapter to reinforce what you've just learned.

Forums and Online Communities

If you prefer a more community-based approach, you can use online forums and discussion groups to engage with like-minded individuals. 

This can be immensely helpful because it allows you to seek advice and learn from others’ experiences in markup languages and web programming. 

Forums like Stack Overflow, the biggest name in the game, bring together learners and experts passionate about markup languages and programming in general. These platforms allow you to participate in discussions and receive guidance from experienced practitioners.

Interactive Code Editors

You can try interactive code editors if you prefer a more interactive learning experience. Online platforms like CodePen and Codecademy allow you to experiment with markup language code and see the results real-time in your browser. 

CodePen landing page

This hands-on approach can help solidify your understanding by providing instant feedback on your code. Plus, it’s a perfect environment to experiment without fear of negatively impacting your live site.

Key Takeaways

For beginners venturing into the digital world, markup languages like HTML and XML offer an invaluable foundation. They help your content shine across devices and get the right treatment from search engines. 

Getting started with markup languages can be tricky, but that shouldn’t stop you. Use Semrush’s Site Audit to detect and assist you in correcting any markup errors.

And for those looking to push the envelope further in SEO, check out our schema markup guide to unlock even greater search visibility.

Share
Author Photo
Samy Ben Sadok has 7+ years of experience in SEO and digital marketing. He has developed skills in areas like e-commerce, AI & automation, and data analytics. He’s currently managing SEO at KuCoin, the fourth-largest crypto exchange globally. At Semrush, he applies his SEO and marketing knowledge to deliver reliable growth strategies.
More on this