Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

html

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?

like image 949
user1985189 Avatar asked May 16 '14 13:05

user1985189


People also ask

What is the value attribute in HTML?

Definition and Usage. For <button>, <input> and <option> elements, the value attribute specifies the initial value of the element. For <li> elements, the value attribute sets the value of the list item (for ordered lists). The next list items will increment from that value.

Can I have multiple values in one HTML data element?

Can I have multiple values in one HTML "data-" element? You can have a string. The spec doesn't define any particular format for the data in the attribute, which is designed to be processed by site specific JavaScript. Similar to how a class can have multiple class names. The class attribute takes a space separated list of classes.

What is the use of form attribute in HTML?

The attribute can be used with form controls (such as the value of textarea elements), or in elements in an editing host (e.g., using contenteditable attribute). Describes elements which belongs to this one. Indicates the form that is the owner of the element. Indicates the action of the element, overriding the action defined in the <form> .

How to set the value of an element in HTML?

For <button>, <input> and <option> elements, the value attribute specifies the initial value of the element. For <li> elements, the value attribute sets the value of the list item (for ordered lists). The next list items will increment from that value. For <meter> elements, the value attribute specifies the current value of the gauge.


1 Answers

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.

like image 135
Quentin Avatar answered Sep 25 '22 17:09

Quentin