user1985189
user1985189

Reputation: 669

For HTML attributes with only one possible value, can the value be omitted?

I'm working with some ancient web application that uses frames. There is an attribute of <frame> called noresize, whose value can only be specified as "noresize". I've noticed in the code that noresize is not assigned a value:

<frame name="client_search_banner" src="pdc?page=client_search_banner.htm" noresize scrolling="no">

At first I thought that noresize scrolling was one attribute, but from everything I've read they appear to be two completely separate things. I'm wondering if the value is assumed in this case since there is only one possible value. Can someone please confirm?

Upvotes: 6

Views: 284

Answers (3)

Quentin
Quentin

Reputation: 944568

In HTML 4.01 and earlier, you can omit everything except the attribute value.

In XHTML, you cannot omit anything.

In HTML 5 and newer, you can omit everything except the attribute name.

Since the name and value are always the same for boolean attributes in HTML, the HTML 4 and 5 rules are effectively the same.

Upvotes: 10

Paul May
Paul May

Reputation: 51

noresize is a boolean attribute. When it's present, it's true, when it's not present, it's false. See the W3C docs for more details about noresize and other attributes.

http://www.w3.org/TR/html401/present/frames.html

Upvotes: 5

Scimonster
Scimonster

Reputation: 33409

These are called Boolean attributes. In XHTML, they must have a value, but in HTML, the value can be omitted. It also doesn't make a difference what the value is if it's there.

Upvotes: 7

Related Questions