HTML egenskaber
- Previous page HTML elementer
- Next page HTML titler
egenskaber giver HTML-elementet yderligere information.
HTML egenskaber
HTML-etiketter kan haveattributeEgenskaber giver oplysninger om HTML-elementetMere information.
Egenskaber fremtræder altid som navne/værdi par, f.eks.:name="value".
Egenskaber er altid i HTML-elementetsStartetiketdefineret.
Egenskabs eksempel
HTML-link defineres af <a>-etiketten. Linkets adresse specificeres i href-egenskaben:
<a href="http://www.codew3c.com">Dette er et link</a>
Flere HTML egenskabs eksempler
Egenskabs eksempel 1:
<h1> Definerer begyndelsen af en titel.
<h1 justering="centreret"> Har yderligere oplysninger om justeringen.
Prøv det selv: Centreret titel
Egenskabs eksempel 2:
<body> Definerer HTML-dokumentets hovedindhold.
<body baggrundsfarve="gul"> Har yderligere oplysninger om baggrundsfarven.
Try it yourself: background color
Attribute example 3:
<table> defines an HTML table. (You will learn more about HTML tables in the following chapters)
<table border="1"> has additional information about table borders.
HTML hint: use lowercase attributes
Case sensitivity of attributes and attribute valuesInsensitive.
However, the World Wide Web Consortium recommends lowercase attributes/attribute values in its HTML 4 recommendation standard.
However, the new version of (X)HTML requires the use of lowercase attributes.
Always quote attribute values
Attribute values should always be enclosed in quotes. Double quotes are the most commonly used, but it is also fine to use single quotes.
In some particular cases, such as when the attribute value itself contains double quotes, you must use single quotes, for example:
name='Bill \
HTML attribute reference manual
Our complete HTML reference manual provides a complete list of legal attributes that each HTML element can use:
Complete HTML reference manual
The following list shows the attributes applicable to most HTML elements:
attribute | value | description |
---|---|---|
class | classname | class name (classname) for specified elements |
id | id | unique id for specified elements |
style | style_definition | inline style for specified elements |
title | text | Additional information about specified elements (which can be displayed in a tooltip) |
For more information about standard attributes, please visit:
- Previous page HTML elementer
- Next page HTML titler