110 likes | 202 Views
CS110: Computers and the Internet. Strict HTML, URLs, and well designed websites. Writing Strict HTML 4.0. An HTML document is composed out of elements that begin and end with tags: < start tag> contents </end tag> Some HTML tags that you have seen: Structural tags Header tags
E N D
CS110: Computers and the Internet Strict HTML, URLs, and well designed websites
Writing Strict HTML 4.0 • An HTML document is composed out of elements that begin and end with tags: • <start tag> contents </end tag> • Some HTML tags that you have seen: • Structural tags • Header tags • Text tags • List tags • Other tags • Comments <!-- I can say anything I want in a comment. -->
Writing Strict HTML 4.0 • Some tags have attributes: • <a href="http://www.yahoo.com">Yahoo!</a> • <imgsrc = "small_weasel.jpg" alt = "a small weasel”> • <tag attr1 = "value1" attr2 = "value2" ... attrN = "valueN"> contents</tag> • Start each page with a DOCTYPE, following by the <html> element • Only <head> and <body an go directly inside your <html> element • Always give your <head> element a <title> element • You can put only block elements inside your <body> elements • You can only put inline elements inside other inline elements • Keep block elements out of your <p> elements • Only <li> elements inside <ol> or <ul> elements • <blockquote> requires one or more block elements inside it
More on <img> <imgsrc=“Eiffel.jpg” alt=“The Eiffel Tower” title=“The Eiffel Tower” width=“width go here” height=“height goes here”> <imgsrc=“Eiffel.jpg” alt=“The Eiffel Tower” title=“The Eiffel Tower” width=“320” height=“240”> Always specify width or height but not both URL Original picture is 160x240. What is the Aspect Ratio?
URLs Absolute URL:
Tree Structured Directory File in the same folder: link in buffy.html to the file willow.html File in sibling folder: link in mythology.html to the file angel.html File in a folder “above”: link in host.html to the file season3.html File in a folder that’s multiple levels up: link in buffy.html to comics.html
Putting it all together… 1) Add a link in comics.html to the file gunn.html 2) Add a link in host.htmlto the file buffy.html
Fragments • Navigation menu • 2 steps: • Give the destination a name:<h2 id=“relative”>Relative URLs</h2> • Add a destination name to the link: • In the same file, just use the id name: <a href=“#relative”>Relative URLs</a>
Well-Designed Websites • What makes a website well-designed?