Attribute HTML

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Name : Christian Matthew Wiwaha

NIM : 001202100131

No. Attribute Tag Description


To adjust the width
1. Width <img>, <video> of an object (in
pixel)
To adjust the height
2. Height <img>, <video> of an object (in
pixel)
<img>, <video>, To specifies the path
3. Src <audio>, <iframe>, to the image to be
<embed> displayed
To specifies the
alternate text for
4. Alt <img> image if the image
somehow can’t be
displayed
To add style for
some element on
5. Style Global Attributes
your html (color,
font, size, etc)
To declare the
6. Lang <html> language of the
webpage
To defines some
7. Title Global Attributes extra information for
some element
To specifies a
8. Id Global Attributes unique id for html
element
To loop a video or
9. Loop <video>, <audio> an audio every time
it is finished
To mute the audio
10. Muted <video>, <audio>
output of a video
To define the shape
11. Shape <area>
of an area
To specifies the
12. Coords <area>
coordinate area

13. Maxlength <input> To specifies the max


number of characters
that allowed in this
element
To specifies the min
number of characters
14. Minlength <input>
that allowed in this
element
To specifies a short
hint that describe the
15. Placeholder <input>
expected value in
this element
To specifies the type
16. Type <input>
of the element
To run a script when
17. Onended <video>, <audio>
the media ended
To run a script when
something bad
happens and the file
18. Onemptied <video>, <audio> is suddenly
unavailable (like
unexpectedly
disconnects)
To run a script when
19. Onerror <video>, <audio>
an error occurs
To make a shortcut
keys to
20. Acceskey Global Attributes
focus/activate an
element
To specifies one or
21. Class Global Attributes
more class name
<button>, To autofocus an
22. Autofocus <textarea>, <input>, element when the
<select> page load
To put an image
before the video
23. Poster <video> downloaded or
before the user hit
the play button
To specifies that an
24. Readonly <input>, <textarea> input field or
textarea is read-only
To make the
25. Reversed <ol> orederes list become
reversed (9,8,7,..)
26. Required <input>, <select>, To specifies that the
<textarea> element need to be
filled before
submitting the form

Notes :
1. W3Schools recommend always quote every attribute, and if your attribute need a
quote in it, you can use a single quote instead of double quote, and vice versa.
Example:
<p title=’Christian”matthew”wiwaha’>this is a paragraph</p> or
<p title=”Christian’matthew’wiwaha”>this is paragraph</p>
2. There are 2 types of URL link of src attribute :
a) Absolute URL : this type of URL is used when you’re using image on another
website, in addition, your picture will be deleted if the website hosts delete the
image on their website.
b) Relative URL : this type of URL is used when you already downloaded the
image in your computer (beware of copyrights).
3. On title attribute, the title will be displayed if your mouse is on the element where you
put the title attribute.
4. On id attribute, id must be unique (different with other), this attribute usually used to
point element for style in CSS or JS.
5. On class attribute, this attribute is also usually used to point element for style in CSS
or JS, but the different between id is the same class can be put in one or more
elements, but the id attribute is only can be put in one element.
6. On some attributes above, the onended, onerror, onemptied attribute needs a Java
Script to use it.
7. On readonly attribute, it is used to make the text from text area can’t be edited, but the
user still can copy the text from the textarea.

You might also like