Académique Documents
Professionnel Documents
Culture Documents
Menu
Log in
Attributs HTML :
‹ Précédent: Suivant ›
Attributs HTML :
Tous les éléments HTML
peuvent avoir des attributs
Les attributs fournissent des
informations
supplémentaires sur les
éléments
Les attributs sont toujours
spécifiés dans la balise de
début
Les attributs se présentent
généralement sous la forme de
paires nom/valeur telles que :
nom="valeur"
L'attribut href :
La <a> balise définit un lien
hypertexte. L' href attribut spécifie
l'URL de la page vers laquelle le lien
va.
Exemple:
<a
href="https://www.w3schools.
com">Visit W3Schools</a>
Essayez-le vous-même »
L'attribut src :
The <img> tag is used to embed an
image in an HTML page. The src
attribute specifies the path to the
image to be displayed:
Example
<img src="img_girl.jpg">
Try it Yourself »
Example
<img src="img_girl.jpg"
width="500" height="600">
Try it Yourself »
Example
<img src="img_girl.jpg"
alt="Girl with a jacket">
Try it Yourself »
Example
See what happens if we try to display
an image that does not exist:
<img src="img_typo.jpg"
alt="Girl with a jacket">
Try it Yourself »
ADVERTISEMENT
Unicaf
Ouvrir
Example
<p style="color:red;">This
is a red paragraph.</p>
Try it Yourself »
<!DOCTYPE html>
<html lang="en">
<body>
...
</body>
</html>
<!DOCTYPE html>
<html lang="en-US">
<body>
...
</body>
</html>
Example
<p title="I'm a
tooltip">This is a
paragraph.</p>
Try it Yourself »
We Suggest: Always
Quote Attribute Values
The HTML standard does not require
quotes around attribute values.
Good:
<a
href="https://www.w3schools.
com/html/">Visit our HTML
tutorial</a>
Bad:
<a
href=https://www.w3schools.c
om/html/>Visit our HTML
tutorial</a>
Example
Try it Yourself »
Or vice versa:
Try it Yourself »
Chapter Summary
All HTML elements can have
attributes
The href attribute of <a>
specifies the URL of the page
the link goes to
The src attribute of <img>
specifies the path to the image
to be displayed
The width and height
attributes of <img> provide
size information for images
The alt attribute of <img>
provides an alternate text for an
image
The style attribute is used to
add styles to an element, such
as color, font, size, and more
The lang attribute of the
<html> tag declares the
language of the Web page
The title attribute defines
some extra information about
an element
HTML Exercises
Exercise:
Add a "tooltip" to the paragraph
below with the text "About
W3Schools".
<p ="About
W3Schools">W3Schools is
a web developer's site.
</p>
Submit Answer »
HTML Attribute
Reference
‹ Previous Next ›
ADVERTISEMENT
COLOR PICKER
Get certified
by completing
a HTML
course today!
school
w3 s
3
CE
02
TI 2
R
FI .
ED
Get started
ADVERTISEMENT
Report Error
Spaces
Upgrade
Newsletter
Get Certified
Top Tutorials
HTML Tutorial
CSS Tutorial
JavaScript Tutorial
How To Tutorial
SQL Tutorial
Python Tutorial
W3.CSS Tutorial
Bootstrap Tutorial
PHP Tutorial
Java Tutorial
C++ Tutorial
jQuery Tutorial
Top References
HTML Reference
CSS Reference
JavaScript Reference
SQL Reference
Python Reference
W3.CSS Reference
Bootstrap Reference
PHP Reference
HTML Colors
Java Reference
Angular Reference
jQuery Reference
Top Examples
HTML Examples
CSS Examples
JavaScript Examples
How To Examples
SQL Examples
Python Examples
W3.CSS Examples
Bootstrap Examples
PHP Examples
Java Examples
XML Examples
jQuery Examples
Get Certified
HTML Certificate
CSS Certificate
JavaScript Certificate
Front End Certificate
SQL Certificate
Python Certificate
PHP Certificate
jQuery Certificate
Java Certificate
C++ Certificate
C# Certificate
XML Certificate
FORUM | ABOUT