When we talk about markup languages in programming, we don’t mean that someone is trying to raise the price of something. A markup is not a price increase. It’s a way of representing data using a particular type of scripting language.
In this guide, we’re going to discuss what markup languages are, how they work, and when you may use markup languages. We’ll also analyze three different markup languages and their use cases, so that you can gain a firm understanding of how markup works.
What is a Markup Language?
Markup languages are languages used by a computer to annotate a document. These languages are readable by humans, which means that they are usually written using standard words, instead of technical programming language terminology.
Markup languages define the style and structure of a document so that a computer knows how you want that document to appear.
One way to think about it is that markup is like how teachers “mark” or “mark up” their students’ tests. A teacher will write on the test where the student has made a mistake so that they’ll know how to fix it next time. In fact, the term markup languages came from typesetting, where instructions on how to set up a document were “marked up” alongside the document.
Markup does not have to be its own language. In the last two examples, markup is still being used, but not a markup language. What distinguishes markup and markup languages is that markup languages have a set of rules on how to use that language. And they are usually interpreted by computers. Markup, on the other hand, has no defined structure.
The ML in Web Development
You’ve probably heard ML at some point if you’ve ever developed a website. HTML and XML, for example, both end in ML. Have you ever asked yourself what these mean? Well, ML stands for markup language.
Markup languages are used extensively across web development. They are used to describe how a particular set of data should be represented on a web document.
HTML (HyperText Markup Language) describes the structure of a web page. XML, on the other hand, describes a particular type of data.
How Markup Languages Work
All markup languages have a common feature: they use tags to denote different types of content on the web page. These markup symbols are usually written in angle brackets (<>
).
Markup languages need a way to distinguish the text they are trying to represent from the instructions that the computer needs to read. Any text that appears within markup tags is interpreted by the machine as an instruction.
Consider this example:
<a href="https://careerkarma.com">Career Karma</a>
This is a link to the Career Karma homepage. We have used an <a> tag to define this link, and when our link is over we close it with an </a> tag.
These tags tell our computer that we want to render a link, or an anchor (which is where the “a” comes from). These tags will not appear on our web page. They are instructions for our web browser to read, so they know how to show a particular web page.
Markup files are saved as plain text documents. This means you can open them using a standard text editor.
Markup Languages vs. Programming Languages
It’s true: markup languages sounds like they should be programming languages. We’re talking about languages after all! Just because these two terms sound the same, it does not mean that they are the same thing.
A programming language is a set of instructions given to a computer that produces various different types of output. Ruby, Python and Perl are all programming languages. Markup languages, on the other hand, are used to describe a document.
Whereas you can run a Python or Ruby program, you can’t “run” a marked up document. HTML documents, for example, are not executed; they are rendered by the browser. XML documents are not run either; they are read by a special type of data reader.
What Markup Languages Are There?
You’ll encounter quite a few markup languages if you go digging. There’s so much data out there that we need multiple languages to cover all the potential use cases. With that said, the most common ones are HTML, XML, and XHTML.
HyperText Markup Language
HyperText Markup Language, or HTML, is the main language used in web development. Without it, we wouldn’t have websites. It defines the structure of a web page, such as what titles, images, and text should appear on a page. It also defines in what order those features should appear in the browser. Conversely, CSS (Cascading Style Sheets) are used to define the layout and appearance of pages in the browser.
HTML is one of the standard markup languages. In HTML, tags are used to define every element on a web page, from titles to images to forms.
The HTML language is governed by the international organization World Wide Web Consortium, or the W3C. HTML is so essential to how the web works that a set of international standards are necessary to write and process it consistently.
The newest version of HTML is HTML5, which includes a number of improvements from its predecessor. With that said, most changes to HTML are incremental because of how important the language is to the web.
eXtensible Markup Language
XML, or eXtensible Markup Language, was designed to transport and store data. The language is self-descriptive.
This is because there are no limits to what you can name your XML tags. There are no predefined tags, so you can choose names that precisely describe each point of data within an XML document.
Let’s say you are creating a markup document to keep track of your favorite books. In XML, you could use the following structure:
<book> <title>How to Win Friends and Influence People</title> <author>Dale Carnegie</author> <rating>⅘</rating> </book>
In this example, we’ve created four tags: book
, title
, author
, and rating
. The title
, author
, and rating
tags appear within our book tag. The book tag represents one entry in our XML file.
"Career Karma entered my life when I needed it most and quickly helped me match with a bootcamp. Two months after graduating, I found my dream job that aligned with my values and goals in life!"
Venus, Software Engineer at Rockbot
eXtensible HyperText Markup Language
XHTML is a version of HTML4 which meets the XML standard. It’s largely been replaced by HTML5 thanks to demands for a more diverse feature set. But it is still in use today in some corners of the internet. Most sites that use XHTML are those developed years ago that haven’t been updated in a while.
XHTML and HTML are very similar, but there are a few differences that you may notice. For instance, HTML attributes must have both a name and a value; you can’t use standalone attributes. In addition, all XHTML tags are written in lowercase. In HTML, you can write using uppercase or lowercase, even though best practices suggest you should use lowercase.
Conclusion
Markup languages are used to define elements within a document. These languages, like HTML and XML, are designed to be readable by humans. This makes it easy for you to understand what data markup languages are representing.
In markup languages, markup instructions to the computer are presented using tags. These tags are usually stored between angle brackets (<>
).
Now you’re ready to start talking about markup languages like a web development expert!
About us: Career Karma is a platform designed to help job seekers find, research, and connect with job training programs to advance their careers. Learn about the CK publication.