Semantic Markup
Semantic markup is a way of writing and structuring your HTML so it reinforces the meaning of the content rather than its appearance.
Semantic HTML for meaningful websites.Web Accessibility
Accessibility is the practice of making your websites usable by as many people as possible.
We traditionally think of this as being about people with disabilities, but the practice of making sites accessible also benefits other groups such as those using mobile devices, or those with slow network connections.
https://developer.mozilla.org/en-US/docs/Learn/Accessibility/What_is_accessibilityBasic HTML accessibility.
- Always provide an "alt" text in images. This will help people with screen readers to identify the
content of the image.
- When including Videos with autoplay, make sure you allow users to stop it if they are more than 5 seconds long. Videos should be muted by default, allowing users to enable audio.
- Websites should be viewed in mobile devices in portrait and landscape modes.
- Web pages should only scroll horizontally or verticaly. Not both.
- Use Headings appropriately. There should be only 1
< h1 >
tag per page. - HTML content should follow a logical reading order, regardles of the layout on the page.
- Make sure the text is legible by allowing enough space, between letters and lines.
- There should be enough contrast between text color and background.
- Use descriptive text for Links. Cliick Here is not good enough. Read more needs more context. Read more about our latest product.
Guide to Web accessibility by SilkTide
Why Alt text Matters
When you fail to provide an alt attribute, screen readers will still announce there is an image, and will read out the file name.
Alt text has two main purposes:
- Accessibility: alt text provides a text description so that people who cannot see the image can still understand what its about.
- Fail state: if the image fails to load for whatever reason, the text alternative will be displayed on the page, so the context of it is not lost.
When writing alt text, you have to strike a balance between too descriptive and too generic.
A cat.
A close up headshot of a ginger cat wearing mirrored sunglasses. It's in a car, and its sunglasses reflect the dark orange clouds of a sunset.
An artistic portrait shot of a cat. Set against a subdued background which depicts a soft bokeh effect with an interplay of light and shadow. The cat has meticulously detailed medium length fur, which displays varying shades of earthy browns and oranges against a white face mask and pink nose, reminiscent of the classic tabby pattern. What captures immediate attention are the round, reflective sunglasses it adorns. These mirrored glasses encapsulate a scene with a setting sun and thick dark orange clouds. The cat's whiskers appear prominent, adding symmetry of the image. It's sitting in a car, which offers a sense of sophistication by fusing the natural world with elements of human luxury.
Structural HTML Tags
We use them to structure the content of webpages.
The DIV Tag
- <div></div>
- This is called the Division Tag.
- Is the most used tag in web development.
- It is a generic container tag used to separate and structure content.
- Groups various HTML tags so they can be styled as a group.
- They are used with ids and classes for styling and positioning.
- Divs do not give semantic meaning to the content inside.
A note on closing tags
- HTML elements usually consist of a start and end tag, with the content in between.
- <p> content goes here </p>
- Note the / before the tag name, on the closing tag </p>
- There are some tags that do not need closing, because they hold no content in between.
- They are empty elements that either add external elements or break the flow of the page
- <img>, <br>, <hr>, <link>, <meta>, <input> are the most common.