What Are HTML Attributes?

HTML attributesTo make a website, small business owners now have the advantage of website builder software. These tools offer sophistication behind the scenes, inserting attributes for customized styles with no more than the click of a button. 

However, if you plan to build a website for yourself, you’ll need a basic understanding of HTML and how attributes define the specific behavior of the elements used in the code. 

How Attributes Work With Elements 

An attribute might be used to specify how far the text is indented from the left side of the screen, or it might be used to make text larger or smaller. The following example shows how the attribute can define the font size for the words For More Information.

<span style=“font-size: medium;”> For More Information </span>

In this case, <span> and </span> are the opening and closing of the element, and style=”font-size: medium” is the attribute, giving further information on how the designer wants the text to appear.

It’s not really possible to make a website without using attributes. If you fail to use an attribute, the element will resort to its default. This can produce some pretty strange results, and you will have little to no control over how your website appears. Therefore, it’s not desirable or practical to disregard attributes.

Of the 93 standard elements in HTML, many have specific attributes that can’t be used with other elements. There are also attributes that can be used with any element; the style and title attributes are just two examples. By learning about different attributes you can use to modify various elements, you’ll be able to produce cleaner, more effective code and a more professional website.

A Few Basics

Like anything else in HTML, there are specific rules that need to be followed when using attributes. An attribute’s value is always put in quotes. Double quotes are standard, but single quotes may also be used. Attributes are technically case-insensitive, so values can be expressed in all caps, lowercase, or in any combination you choose. However, most people agree that it’s best to use lowercase text when writing attributes, and because it’s also smart to be consistent when writing HTML code, sticking to lowercase keeps the process more manageable.

Take Care with Attributes

If your website looks odd after including some new code, there’s a good chance that the attributes are to blame. One small typo, such as a missing quote mark, can wreak havoc with the appearance of a web page. If text looks too small, for instance, you might assign a higher value. If images aren’t centered properly or otherwise look strange, take a careful look at your attributes. All it takes is one incorrect value to give you different end-results than you anticipated.

This article was provided by Patriot Software, Inc., a developer of online software for U.S. small businesses, including online payroll softwareapplicant tracking softwarehuman resources software, an employee portal, and 1099 software. Patriot Software also offers a payroll tax filing service for payroll customers, and is currently developing bookkeeping software and a website builder. For more information, visit www.PatriotSoftware.com

We provide fast, simple, and affordable accounting and payroll software. After a rough start-up experience, we know first hand what small businesses need in order to breakthrough and achieve success. So we created a software service to help you keep the two things you don’t have enough of… time and money.

Leave a Reply