<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jozsef Polgar</title>
    <description>The latest articles on DEV Community by Jozsef Polgar (@polgarj).</description>
    <link>https://dev.to/polgarj</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F453470%2F3b14ce30-941e-4f9e-a830-61c342d1e4ba.jpg</url>
      <title>DEV Community: Jozsef Polgar</title>
      <link>https://dev.to/polgarj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/polgarj"/>
    <language>en</language>
    <item>
      <title>A short guide to help you pick the correct HTML tag</title>
      <dc:creator>Jozsef Polgar</dc:creator>
      <pubDate>Tue, 28 Sep 2021 20:40:41 +0000</pubDate>
      <link>https://dev.to/polgarj/a-short-guide-to-help-you-pick-the-correct-html-tag-56l9</link>
      <guid>https://dev.to/polgarj/a-short-guide-to-help-you-pick-the-correct-html-tag-56l9</guid>
      <description>&lt;p&gt;A semantically correct HTML tag informs the browser and the developer about its content. It also helps keyboards and assistive technologies to navigate through a website.&lt;/p&gt;

&lt;p&gt;There are &lt;em&gt;more than 100 HTML tags&lt;/em&gt;, but which ones are semantic and which are not?&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Non-semantic elements:&lt;/strong&gt; div and span, etc. Unlike semantic elements, these are not holding any extra information about their content.&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Semantic elements:&lt;/strong&gt; header, main, footer, article, img, p, h1, etc.&lt;/p&gt;

&lt;p&gt;When you create a new HTML file, you have something like this:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;

&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
        ...
    &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
        ...
    &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;I will focus on &lt;strong&gt;what's inside the body element&lt;/strong&gt; and name only the most important tags.&lt;/p&gt;

&lt;p&gt;The HTML tags can be separated into different groups and it helped me to understand the whole concept and I think this is the best way to explain it, so let's start.&lt;/p&gt;
&lt;h2&gt;
  
  
  Content sectioning or landmarks
&lt;/h2&gt;

&lt;p&gt;The layout of the main page of &lt;a href="https://uselessdivs.com/" rel="noopener noreferrer"&gt;my blog&lt;/a&gt;  looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuselessdivs.com%2Fimg%2Fa-short-guide-to-help-you-pick-the-correct-html-tag%2Flayout.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fuselessdivs.com%2Fimg%2Fa-short-guide-to-help-you-pick-the-correct-html-tag%2Flayout.svg" alt="A visual representation of the main elements of the website, such as header, nav, main, section, article, aside."&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  header and nav
&lt;/h3&gt;

&lt;p&gt;In my &lt;code&gt;&amp;lt;header&amp;gt;&lt;/code&gt;, you can find the logo, which is a link and it leads to the main page and &lt;code&gt;&amp;lt;nav&amp;gt;&lt;/code&gt; element which contains the links to my other pages.&lt;br&gt;
You can also put here some &lt;strong&gt;introduction about the page&lt;/strong&gt;, a search bar, or other elements.&lt;/p&gt;
&lt;h3&gt;
  
  
  main
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt; element holds different content on each page. This &lt;strong&gt;holds the primary information&lt;/strong&gt; of the current page &lt;strong&gt;or the main functionality&lt;/strong&gt; of an application.&lt;/p&gt;
&lt;h3&gt;
  
  
  footer
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt;tag creates a footer for a section or for the whole document. You can have multiple &lt;code&gt;&amp;lt;footer&amp;gt;&lt;/code&gt; elements in one page, which typically contains data, like: contact info to the author, copyrigt information, related links etc.&lt;/p&gt;
&lt;h3&gt;
  
  
  aside
&lt;/h3&gt;

&lt;p&gt;You can also find the &lt;code&gt;&amp;lt;aside&amp;gt;&lt;/code&gt; on the right side of my page. It &lt;strong&gt;holds complementary content&lt;/strong&gt;. If I remove it, nothing will be missing from the primary content. You can put here for example table of contents, related posts, etc.&lt;/p&gt;
&lt;h3&gt;
  
  
  section
&lt;/h3&gt;

&lt;p&gt;Inside my &lt;code&gt;&amp;lt;main&amp;gt;&lt;/code&gt; element, you can find the &lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt; tag. If there isn't a more specific HTML element for a part of your document, you can group related elements with this tag. This element should &lt;strong&gt;always&lt;/strong&gt; have a heading.&lt;/p&gt;
&lt;h3&gt;
  
  
  h1 - h6
&lt;/h3&gt;

&lt;p&gt;Heading elements: &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; &lt;code&gt;&amp;lt;h2&amp;gt;&lt;/code&gt; &lt;code&gt;&amp;lt;h3&amp;gt;&lt;/code&gt; &lt;code&gt;&amp;lt;h4&amp;gt;&lt;/code&gt; &lt;code&gt;&amp;lt;h5&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;h6&amp;gt;&lt;/code&gt;, are the titles of the different sections. &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; is the highest level of the headings, and it is necessary to have one on each page but there should be only one per page. &lt;code&gt;&amp;lt;h6&amp;gt;&lt;/code&gt; is the lowest. If you run out of headings, there is another option: &lt;a href="https://uselessdivs.com/blog/the-7th-heading" rel="noopener noreferrer"&gt;the 7th heading&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The reason you should use landmarks is that screen readers and other &lt;em&gt;assistive technologies can jump back and forth between these elements&lt;/em&gt;.&lt;br&gt;
For example, all the pages have the same header with the same logo, the same navigation, but with a keyboard shortcut, you can jump over them and start with the content of the main tag.&lt;/p&gt;
&lt;h2&gt;
  
  
  Text content elements
&lt;/h2&gt;

&lt;p&gt;These can help you &lt;strong&gt;organize the written content&lt;/strong&gt; on your pages and give information about the content to search engines and screen readers.&lt;/p&gt;
&lt;h3&gt;
  
  
  P
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; stands for paragraph. In other words, a block of text. You will use it a lot for wrapping your text content with it.&lt;/p&gt;
&lt;h3&gt;
  
  
  ul, ol, li
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; - unordered list, &lt;code&gt;&amp;lt;ol&amp;gt;&lt;/code&gt; - ordered list, &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt; - list elements of the two kind of lists. If you need to create a list you have to use them.&lt;/p&gt;

&lt;p&gt;List items are wrapped in &lt;em&gt;&lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt;, if the order is not important&lt;/em&gt;. It will put bullet points before each list item.&lt;/p&gt;

&lt;p&gt;Choose &lt;em&gt;&lt;code&gt;&amp;lt;ol&amp;gt;&lt;/code&gt;, if the order of your list items is important.&lt;/em&gt; By default, it will put a number before each item in ascending order.&lt;/p&gt;
&lt;h3&gt;
  
  
  Figure, figcaption, blockquote, cite
&lt;/h3&gt;

&lt;p&gt;I will explain all of them with one example. Look at this block of code:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;

&lt;span class="nt"&gt;&amp;lt;figure&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;blockquote&lt;/span&gt; &lt;span class="na"&gt;cite=&lt;/span&gt;&lt;span class="s"&gt;"https://www.htmhell.dev/24-a-placeholder-is-not-a-label/"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
        Every form input element needs a label.
    &lt;span class="nt"&gt;&amp;lt;/blockquote&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;figcaption&amp;gt;&lt;/span&gt;Manuel Matuzović, &lt;span class="nt"&gt;&amp;lt;cite&amp;gt;&lt;/span&gt;A placeholder is not a label - HTMHell&lt;span class="nt"&gt;&amp;lt;/cite&amp;gt;&amp;lt;/figcaption&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/figure&amp;gt;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;figure&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;figcaption&amp;gt;&lt;/code&gt; go hand in hand&lt;br&gt;
The &lt;code&gt;&amp;lt;figure&amp;gt;&lt;/code&gt; is a self-contained element optionally, but usually with a caption. This caption is the &lt;code&gt;&amp;lt;figcaption&amp;gt;&lt;/code&gt; element.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;blockquote&amp;gt;&lt;/code&gt; is for quotations, where you want to indicate the author, the source, etc. (You can use the cite attribute on this tag to give the URL of the source of this quotation).&lt;br&gt;
&lt;code&gt;&amp;lt;cite&amp;gt;&lt;/code&gt; element &lt;em&gt;is holding the reference to a quoted content&lt;/em&gt;. Name of the author, title of the cited material, etc. and this is the first element of our next group, the inline text elements.&lt;/p&gt;
&lt;h2&gt;
  
  
  Inline text elements
&lt;/h2&gt;

&lt;p&gt;You can wrap smaller parts of text like words, sentences, etc into different tags to define its style, meaning, or structure.&lt;/p&gt;
&lt;h3&gt;
  
  
  a
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; or anchor elements are links, which have a &lt;strong&gt;href&lt;/strong&gt; attribute, which leads to &lt;em&gt;other web pages, files, email addresses, phone numbers, or a location on the same page&lt;/em&gt;.&lt;/p&gt;
&lt;h3&gt;
  
  
  em
&lt;/h3&gt;

&lt;p&gt;Use this element to &lt;strong&gt;emphasize any text content.&lt;/strong&gt; &lt;em&gt;Screen readers read this part of a text in a different way.&lt;/em&gt; Browsers render the content of this text in italic font style but don't use it only for styling.&lt;/p&gt;
&lt;h3&gt;
  
  
  strong
&lt;/h3&gt;

&lt;p&gt;Use this element to &lt;strong&gt;mark content, which is more important&lt;/strong&gt; than the rest of the text. &lt;strong&gt;Screen readers read this part of a text in a different way.&lt;/strong&gt; Browsers render the content of this text in bold font style but don't use it only for styling.&lt;/p&gt;
&lt;h3&gt;
  
  
  q
&lt;/h3&gt;

&lt;p&gt;A short inline quotation, which doesn't need an entire paragraph. (You can use the cite attribute on this tag to give the URL of the source of this quotation)&lt;/p&gt;
&lt;h2&gt;
  
  
  Image and multimedia
&lt;/h2&gt;
&lt;h3&gt;
  
  
  audio
&lt;/h3&gt;

&lt;p&gt;audio is used to embed sound into your website.&lt;/p&gt;
&lt;h3&gt;
  
  
  img
&lt;/h3&gt;

&lt;p&gt;img is used to embed an image into your website.&lt;/p&gt;
&lt;h3&gt;
  
  
  video
&lt;/h3&gt;

&lt;p&gt;video is used to embed a video into your website.&lt;/p&gt;
&lt;h2&gt;
  
  
  Table content
&lt;/h2&gt;

&lt;p&gt;I think an example is the easiest way to explain these elements:&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/polgarj/embed/vYZvwrQ?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;br&gt;&lt;br&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  table
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;table&amp;gt;&lt;/code&gt; creates a two-dimensional table with rows and columns&lt;/p&gt;
&lt;h3&gt;
  
  
  thead
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;thead&amp;gt;&lt;/code&gt; is a row or rows that define the column heading&lt;/p&gt;
&lt;h3&gt;
  
  
  th
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;th&amp;gt;&lt;/code&gt; is a single cell as a header of a group of cells. This group of cells can be a column or a row, and you have to define it by the scope attribute. The scope attribute can have the value of col or row.&lt;/p&gt;
&lt;h3&gt;
  
  
  tbody
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;tbody&amp;gt;&lt;/code&gt; wraps the main content of our table, which is usually between the thead and the tfoot elements.&lt;/p&gt;
&lt;h3&gt;
  
  
  tr
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;tr&amp;gt;&lt;/code&gt; defines a row of cells in a table.&lt;/p&gt;
&lt;h3&gt;
  
  
  td
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;td&amp;gt;&lt;/code&gt; stands for table data. This is a single cell that holds the information.&lt;/p&gt;
&lt;h3&gt;
  
  
  tfoot
&lt;/h3&gt;

&lt;p&gt;This is a row at the end of the table, that summarizes its content.&lt;/p&gt;
&lt;h2&gt;
  
  
  Forms
&lt;/h2&gt;
&lt;h3&gt;
  
  
  form
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt; element wraps the entire form that users can use to enter their data and submit it to the server.&lt;/p&gt;
&lt;h3&gt;
  
  
  fieldset
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;fieldset&amp;gt;&lt;/code&gt; groups related inputs in a form. Fieldsets need a caption and this caption is the legend element. For example, if you have a form with a shipping address and billing address, you can create two groups of inputs with the fieldset element.&lt;/p&gt;
&lt;h3&gt;
  
  
  legend
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;legend&amp;gt;&lt;/code&gt; element defines a caption for the fieldset.&lt;/p&gt;
&lt;h3&gt;
  
  
  input
&lt;/h3&gt;

&lt;p&gt;Users can interact with &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt; elements to enter their data. &lt;em&gt;There are many different kinds of input fields for different types of information&lt;/em&gt;, like text, color, file, etc.&lt;/p&gt;
&lt;h3&gt;
  
  
  label
&lt;/h3&gt;

&lt;p&gt;Every &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt; field needs a caption and this caption is the &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt; element. &lt;strong&gt;You can't replace the &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt; tag with the placeholder attribute.&lt;/strong&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  select and option
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; is a special kind of input field, with a dropdown menu. This dropdown menu contains &lt;code&gt;&amp;lt;option&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;
&lt;h3&gt;
  
  
  textarea
&lt;/h3&gt;

&lt;p&gt;Users can enter &lt;em&gt;multiple lines of text&lt;/em&gt; in this field&lt;/p&gt;
&lt;h3&gt;
  
  
  button
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; tag creates a clickable element, which looks like a button. It is used to submit forms.&lt;/p&gt;
&lt;h2&gt;
  
  
  Others
&lt;/h2&gt;
&lt;h3&gt;
  
  
  iframe
&lt;/h3&gt;

&lt;p&gt;You can embed other HTML files into your website with the &lt;code&gt;&amp;lt;iframe&amp;gt;&lt;/code&gt; element. For example, you can insert a song from Spotify or a video from YouTube into your website.&lt;/p&gt;
&lt;h3&gt;
  
  
  picture
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;picture&amp;gt;&lt;/code&gt; has almost the same purpose as the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; element, but you can specify more sources and browsers decide, which is the best for them. If you want to use a new image format, like .avif, (which is not yet widely supported at the time I write this post), you should give the image in another format, like png with the &lt;code&gt;&amp;lt;source&amp;gt;&lt;/code&gt; tag.&lt;/p&gt;
&lt;h3&gt;
  
  
  source
&lt;/h3&gt;

&lt;p&gt;With this element you can specify multiple sources for the &lt;code&gt;&amp;lt;picture&amp;gt;&lt;/code&gt;, the &lt;code&gt;&amp;lt;audio&amp;gt;&lt;/code&gt;, and &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; elements, like this:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;

&lt;span class="nt"&gt;&amp;lt;picture&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;source&lt;/span&gt; &lt;span class="na"&gt;srcset=&lt;/span&gt;&lt;span class="s"&gt;"image.png"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;source&lt;/span&gt; &lt;span class="na"&gt;srcset=&lt;/span&gt;&lt;span class="s"&gt;"image.webp"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"image.avif"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/picture&amp;gt;&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h3&gt;
  
  
  svg
&lt;/h3&gt;

&lt;p&gt;I could describe it in a more complicated way, but &lt;code&gt;&amp;lt;svg&amp;gt;&lt;/code&gt; is &lt;em&gt;mostly used to display a vector graphic image&lt;/em&gt;, that you can enlarge or reduce to any size without becoming pixelated.&lt;/p&gt;
&lt;h2&gt;
  
  
  Learn by playing
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://twitter.com/plfstr" rel="noreferrer noopener"&gt;Paul Foster&lt;/a&gt; built this awesome memory game. Test yourself and beat your score tomorrow. &lt;br&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/plfstr/embed/zYqQeRw?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;br&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;
    If you pick the correct elements, your code will be easier to read by other developers,&lt;br&gt;
    it will be easier for assistive technology users to use your website,&lt;br&gt;
    the search engines will rank your website higher (SEO).&lt;br&gt;
    Sometimes you should stop and think about whether there is a better HTML element than the one you want to use.
&lt;/p&gt;

&lt;p&gt;If you are missing something or find any inaccuracies, please let me know and I will add or correct it as soon as I can.&lt;/p&gt;

&lt;p&gt;Originally posted on &lt;a href="https://uselessdivs.com/blog/a-short-guide-to-help-you-pick-the-correct-html-tag" rel="noopener noreferrer"&gt;Use Less Divs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>a11y</category>
      <category>html</category>
    </item>
    <item>
      <title>Use alt attribute properly for accessibility and SEO</title>
      <dc:creator>Jozsef Polgar</dc:creator>
      <pubDate>Sat, 18 Sep 2021 22:02:04 +0000</pubDate>
      <link>https://dev.to/polgarj/use-alt-attribute-properly-for-accessibility-and-seo-3ohp</link>
      <guid>https://dev.to/polgarj/use-alt-attribute-properly-for-accessibility-and-seo-3ohp</guid>
      <description>&lt;p&gt;&lt;code&gt;&amp;lt;img src="image.png" alt="The picture description comes here." /&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Many people miss alternative texts and many misuse them. This is a big mistake, because &lt;strong&gt;they have a huge effect on accessibility and even on SEO&lt;/strong&gt;. Here are 4 reasons why you should pay more attention to writing alternative texts.&lt;/p&gt;

&lt;h2&gt;
  
  
  #1 Image accessibility
&lt;/h2&gt;

&lt;p&gt;Screen reader users are mainly blind or partially sighted people. The main reason for using alt attribute is to describe the images to them. When a screen reader comes to an image it will read the value of the alt attribute for your visitor.&lt;/p&gt;

&lt;h2&gt;
  
  
  #2 Fallback text, if image doesn't load
&lt;/h2&gt;

&lt;p&gt;A lot of things can cause an image not to load on a websites. For example: incorrect file path, missing file, too large image size or bad internet connection.&lt;/p&gt;

&lt;p&gt;In these cases, the &lt;em&gt;alternative text comes and saves the day&lt;/em&gt; because it appears in place of the missing images.&lt;/p&gt;

&lt;h2&gt;
  
  
  #3 Help people to find your images with search engines
&lt;/h2&gt;

&lt;p&gt;When a search engine crawls through your website, it checks your images too and they will index your images based on your alt attributes.&lt;br&gt;
So if you write good alternative text and your image appears in search results, &lt;strong&gt;it can bring you more visitors&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  #4 Add keywords to your homepage
&lt;/h2&gt;

&lt;p&gt;When people are looking for something on the internet, they start typing in search engines. The search engines will show them websites that containing the keywords they are searching for. &lt;em&gt;The more keywords you have on your website, the better your page will rank in the search results.&lt;/em&gt;&lt;br&gt;
And here comes the best part: every single word you write in alt attribute counts as a keyword, so basically you are &lt;strong&gt;improving your search engine optimization&lt;/strong&gt; (SEO).&lt;/p&gt;

&lt;h2&gt;
  
  
  Best practices:
&lt;/h2&gt;

&lt;p&gt;Now that we've learned the benefits of a well-written alternative text, it's time to dive into best practices.&lt;/p&gt;

&lt;h3&gt;
  
  
  Max. 125 characters.
&lt;/h3&gt;

&lt;p&gt;You should write an alternative text as if you were telling someone by phone what is in the picture, but try to be brief, because some screen readers cut off alt text after 125 characters&lt;/p&gt;

&lt;h3&gt;
  
  
  Don't start with "image of ..." or "picture of ..."
&lt;/h3&gt;

&lt;p&gt;Screen readers tell their user that they are hearing the alternative text of an image anyway.&lt;/p&gt;

&lt;h3&gt;
  
  
  Write sentences, not words
&lt;/h3&gt;

&lt;p&gt;If you have a picture of a dog playing with a ball, your alternative text should look like this:&lt;br&gt;
"A small black wiener-dog playing with a red ball."&lt;br&gt;
Never write something like this to get more keywords: "Dog, doggy, doggo, puppy, wiener-dog, dachshund, play, ball".&lt;/p&gt;

&lt;h3&gt;
  
  
  Use empty alt attribute for decorative images
&lt;/h3&gt;

&lt;p&gt;If you have an image just for the looks, you should leave its alt attribute empty, like this: &lt;code&gt;&amp;lt;img src="image.png" alt="" /&amp;gt;&lt;/code&gt;&lt;br&gt;
It is important to include the alt="" part, because in this case screen readers will skip your decorative images.&lt;/p&gt;

&lt;h3&gt;
  
  
  If the image has text, write it down
&lt;/h3&gt;

&lt;p&gt;If an image has text content and it gives extra information to your site, you should include it in the alt attribute.&lt;/p&gt;

&lt;h2&gt;
  
  
  Takeaway:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Always give proper alt attribute to your images.&lt;/li&gt;
&lt;li&gt;If it's a decorative image, give it an empty alt attribute.&lt;/li&gt;
&lt;li&gt;If you keep these few tips in mind, you will not only make your website more accessible, but you can also get more visitors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Originally posted on &lt;a href="https://uselessdivs.com/blog/use-alt-attribute-properly-for-accessibility-and-seo"&gt;Use Less Divs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>a11y</category>
      <category>html</category>
      <category>seo</category>
    </item>
    <item>
      <title>I just started my new blog about accessibility</title>
      <dc:creator>Jozsef Polgar</dc:creator>
      <pubDate>Thu, 26 Aug 2021 17:38:28 +0000</pubDate>
      <link>https://dev.to/polgarj/i-just-started-my-new-blog-about-accessibility-2e9c</link>
      <guid>https://dev.to/polgarj/i-just-started-my-new-blog-about-accessibility-2e9c</guid>
      <description>&lt;p&gt;Hey!&lt;/p&gt;

&lt;p&gt;I just started my new blog about web accessibility. I try to update it as often as possible, so if you’re interested in the topic, feel free to &lt;strong&gt;add it to your bookmarks&lt;/strong&gt;. Every feedback is welcome and appreciated. :)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://uselessdivs.com/"&gt;https://uselessdivs.com/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>javascript</category>
      <category>a11y</category>
    </item>
  </channel>
</rss>
