Last Updated on
An attribute is an addition to an HTML tag that extends or qualifies its meaning.
For example, you can extend the image tag by including the ALIGN attribute that lets you specify how you want a block of text to line up with an image. With the ALIGN attribute you can align text to the left, right, center, top, middle, or bottom of an image. Another attribute used to extend an image tag is the BORDER attribute that allows you to specify the size of the border that appears around an image.
Also See: Tags
Frequently Asked Questions
Do I need to know HTML attributes to use them?
Depending on how you manage your website, you may be able to apply attributes without knowing the specific coding or even the name of the attribute you’re using. Many website builders include a What-You-See-Is-What-You-Get (WYSIWYG) editor, meaning they allow you to arrange your content, change the formatting, and even add features like borders by using a toolbar, very similar to the way you format documents in Microsoft Word or Google Docs. The editor applies the appropriate HTML attributes on the backend, so you never have to see them.
If you’re creating your own website using HTML, or if you are using HTML to personalize a site you’ve created with another program, you may need to know that specific attribute coding rules.
Will attributes look the same in all browsers?
Whenever you create a website, it’s a good idea to test it in multiple web browsers and on multiple devices. While many web design programs allow you to create websites that should look the same across any PC browser or operation system, there are no guarantees. If you are coding the site yourself, there is even a greater chance that some elements may not look the same on Safari as they do in Chrome or Mozilla Firefox. In addition, as the majority of Internet users now do at least some of their browsing on a mobile device, you need to consider how your page will look on a smaller screen. While some attributes may transfer to mobile just fine, more restrictive attributes, particularly those that involve something’s size or location on the page, such the location of text in relation to pictures, may affect the page’s readability on a phone or tablet. Most website builders provide tools that allow sites to automatically adjust for mobile, which should help you avoid these issues.
If I built my site in WordPress, do I need to use attributes?
Content Management Systems (CMS), such as WordPress, make it possible for anyone to easily create a modern and impressive-looking website. For many users the thousands of templates and customization options available are more than enough to create a site that is uniquely your own. However, if your organization requires more specific customization, you may need to modify the template using HTML. In that case, you’ll find yourself taking full advantage of attributes.