- Mastering Responsive Web Design
- Ricardo Zea
- 567字
- 2021-07-16 20:33:19
Chapter 2. Marking Our Content with HTML5
Many consider that HTML is code. Well, it's not. HTML—any version of it—is a markup language.
A markup language is a computer language that can be read and understood by humans. It uses tags to define the parts of the content. HTML and XML are markup languages.
To further help the differentiation, a coding language involves much more complex abstractions, scripting, database connections, transmission of data in some shape or form via complex protocols, and so on. Coding is truly a magical world.
HTML can do all these, but it's way less complex and a lot easier to understand.
In this chapter, we're going to focus on the science behind marking up content. Content can come in many different forms: text, images, videos, forms, error messages, success messages, iconography, and so on. Also, the way a type of content behaves in the browser or the way the user interacts with it will tell us what type of HTML element that specific content should be marked as.
For example, many web designers make an anchor link <a href="#">Start 30 day trial</a>
look like a button. Many web developers make the same anchor link behave like a button. Why not just use the <input type="button" value="Start 30 day trial">
element? Better yet, use the <button>Start 30 day trial</button>
element that behaves exactly the same, is a lot easier to style, and allows the addition of HTML content if necessary.
The idea is to keep our markup as semantic as possible. Semantic markup basically means that we use HTML tags to describe what a specific piece of content is. Keeping a semantic markup has a lot of benefits:
- It's very helpful for other web designers or developers who inherit our work, because they will spend less time reverse engineering what we have done and more time enhancing it.
- It's also extremely helpful in terms of accessibility, because it allows assistive technologies to name the elements as they are: a button is actually a
<button>
and not a link<a href="#">
styled to look like a button. - SEO benefits greatly from semantic markup, because it allows search engines to index the content faster and more accurately.
Paying close attention to the content will go a long way for everyone in the chain—helping us during the project, helping the project itself, and eventually helping our users with and without assistive technology.
The best recommendation I can give you when marking up your content is listen to the content; it talks to you. It really does.
We will cover the following topics in this chapter:
So, which HTML elements can we use now so we're sure our websites/apps look fine in all browsers? The answer is all elements.
On October 28, 2014, the W3C finalized the HTML5 standard. However, all major browsers had been supporting HTML5 elements for several years.
What this means for us is that even way before the W3C finalized the HTML5 standard, we could already use any HTML5 element. So if you've been building websites/apps with HTML5, keep doing it; if you haven't started to use HTML5 yet for any specific reason, this is the time to start.
- Learning Neo4j
- Implementing Modern DevOps
- 案例式C語言程序設計
- 潮流:UI設計必修課
- Julia機器學習核心編程:人人可用的高性能科學計算
- GitLab Repository Management
- 小程序,巧運營:微信小程序運營招式大全
- Learning PHP 7
- 零基礎學Scratch 3.0編程
- Mastering OAuth 2.0
- 人人都能開發RPA機器人:UiPath從入門到實戰
- SQL Server實例教程(2008版)
- 鋁合金陽極氧化與表面處理技術(第三版)
- Testing Practitioner Handbook
- Real-time Web Application Development using Vert.x 2.0