90 likes | 194 Views
Creating Links in HTML—the HT. Chapter 2. Creating Links. <a> element</a> The <a> element is used to create a link to another page The content of the <a> element is the link text. In the browser, the link text appears with an underline to indicate you can click on it. Creating Links .
E N D
Creating Links in HTML—the HT Chapter 2
Creating Links <a> element</a> • The <a> element is used to create a link to another page • The content of the <a> element is the link text. • In the browser, the link text appears with an underline to indicate you can click on it
Creating Links • Once the text is in the link, you need to add HTML to tell the browser where to link the points to <a href=“elixir.html”>elixirs</a> • The href attribute is how you specify the destination of the lnk <a href=“directions.html”>driving directions</a>
Creating Links • Use the <a> element to create a hypertext link to another web page • The content of the <a> element becomes clickable in the web page • The href attribute tells the browser the destination of the link
Creating Links • When the user clicks on a link, the browser uses the href attribute to determine the page the link points to • If “elixirs” was clicked, the browser grabs the href value “elixir.html” • If “detailed directions” was clicked, the browser grabs the href value “directions.html”
Understanding Attributes • Attributes give you a way to specify additional information about an element <style type=“text/css”>--specifies style language <a href=“irule.html”>--tells you the destination of a hyperlink <imgsrc=“sweetphoto.gif”>--specifies the filename of a picture
Understanding Attributes • Example: • What if <car> were an element? • If <car> were an element, you would want to write something like this: • <car>My Red Mini</car> • But this <car> element only gives a descriptive name for your car—not the make, precise model, whether it is a convertible, etc. • So, if <car were really an element, you might want to use attributes like this: • <car> make=“Mini” model=“Cooper” convertible=“no”>My Red Mini</car>