Top Banner
webDEV@RGU creating html pages
41

Creating HTML Pages

Apr 21, 2017

Download

Software

Mike Crabb
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Creating HTML Pages

webDEV@RGUcreating html pages

Page 2: Creating HTML Pages

TodayGoing to look at how we can create an HTML page from a ‘template’. We’ll use:

http://www.rgu.ac.uk

Two parts to this: 1. Looking at the template and splitting it

into different sections 2. Creating the HTML for these individual

sections

Page 3: Creating HTML Pages

Template Deconstruction

Page 4: Creating HTML Pages

this is the page we’ll be looking at

Page 5: Creating HTML Pages

Header Quick Links

Logo Search BarNavigation

Page 6: Creating HTML Pages

Main

3 sections

Page 7: Creating HTML Pages

Header

FormNavigation

Page 8: Creating HTML Pages

Image

Page 9: Creating HTML Pages

Article Article Article

Page 10: Creating HTML Pages

Header

Image

Text (description)

Page 11: Creating HTML Pages

Footer

Heading

Links

Page 12: Creating HTML Pages

Creating the html

Page 13: Creating HTML Pages

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>RGU Homepage</title> </head> <body> </body> </html>

Page 14: Creating HTML Pages

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>RGU Homepage</title> </head> <body> <!--START OF HEADER --> <header> </header> <!--END OF HEADER --> <!--START OF MAIN --> <main> </main> <!--END OF MAIN --> <!--START OF FOOTER --> <footer> </footer> <!--END OF FOOTER --></body> </html>

Page 15: Creating HTML Pages

<header> <div id="quicklinks"> <ul> <li><a href ="#">Home</a></li> <li><a href ="#">About</a></li> <li><a href ="#">RGYou</a></li> <li><a href ="#">Staff & Current Students</a></li> <li><a href ="#">A to Z</a></li> </ul> </div> <img id="rgu_logo" src="robertgordonlogo.jpeg" alt="Robert Gordon University"/> <div id="seachbox"> <form> <p>Search</p> <input type="text" name="searchfield"> <input type="submit" value="Go"> </form> </div> <nav> <ul> <li><a href ="#">Areas of Study</a></li> <li><a href ="#">Future Students</a></li> <li><a href ="#">...</a></li> <li><a href ="#">Contact Us</a></li> </ul> </nav> </header>

1. Everything that we do in the header is contained within our <header> tags

Page 16: Creating HTML Pages

<header> <div id="quicklinks"> <ul> <li><a href ="#">Home</a></li> <li><a href ="#">About</a></li> <li><a href ="#">RGYou</a></li> <li><a href ="#">Staff & Current Students</a></li> <li><a href ="#">A to Z</a></li> </ul> </div> <img id="rgu_logo" src="robertgordonlogo.jpeg" alt="Robert Gordon University"/> <div id="seachbox"> <form> <p>Search</p> <input type="text" name="searchfield"> <input type="submit" value="Go"> </form> </div> <nav> <ul> <li><a href ="#">Areas of Study</a></li> <li><a href ="#">Future Students</a></li> <li><a href ="#">...</a></li> <li><a href ="#">Contact Us</a></li> </ul> </nav> </header>

Quick Links

1. Create a DIV to hold the information in 2. It is best to use an unordered list to create a series of links 3. Use the # symbol when we don’t yet know where the link is going to go

Page 17: Creating HTML Pages

<header> <div id="quicklinks"> <ul> <li><a href ="#">Home</a></li> <li><a href ="#">About</a></li> <li><a href ="#">RGYou</a></li> <li><a href ="#">Staff & Current Students</a></li> <li><a href ="#">A to Z</a></li> </ul> </div> <img id="rgu_logo" src="robertgordonlogo.jpeg" alt="Robert Gordon University"/> <div id="seachbox"> <form> <p>Search</p> <input type="text" name="searchfield"> <input type="submit" value="Go"> </form> </div> <nav> <ul> <li><a href ="#">Areas of Study</a></li> <li><a href ="#">Future Students</a></li> <li><a href ="#">...</a></li> <li><a href ="#">Contact Us</a></li> </ul> </nav> </header>

1. Give the logo an id so that we can style it later in css 2. Use src to give the location of the logo 3. Give the image alternative text to aid with accessibility

Page 18: Creating HTML Pages

<header> <div id="quicklinks"> <ul> <li><a href ="#">Home</a></li> <li><a href ="#">About</a></li> <li><a href ="#">RGYou</a></li> <li><a href ="#">Staff & Current Students</a></li> <li><a href ="#">A to Z</a></li> </ul> </div> <img id="rgu_logo" src="robertgordonlogo.jpeg" alt="Robert Gordon University"/> <div id="seachbox"> <form> <p>Search</p> <input type="text" name="searchfield"> <input type="submit" value="Go"> </form> </div> <nav> <ul> <li><a href ="#">Areas of Study</a></li> <li><a href ="#">Future Students</a></li> <li><a href ="#">...</a></li> <li><a href ="#">Contact Us</a></li> </ul> </nav> </header>

1. Contain the search box in a DIV and give it an ID to make styling easier in CSS 2. The search box should be contained within a form 3. Use the text input type to create the box 4. Use the submit input type to create the button 5. In the future we would add a location for this form to be sent to

Page 19: Creating HTML Pages

<header> <div id="quicklinks"> <ul> <li><a href ="#">Home</a></li> <li><a href ="#">About</a></li> <li><a href ="#">RGYou</a></li> <li><a href ="#">Staff & Current Students</a></li> <li><a href ="#">A to Z</a></li> </ul> </div> <img id="rgu_logo" src="robertgordonlogo.jpeg" alt="Robert Gordon University"/> <div id="seachbox"> <form> <p>Search</p> <input type="text" name="searchfield"> <input type="submit" value="Go"> </form> </div> <nav> <ul> <li><a href ="#">Areas of Study</a></li> <li><a href ="#">Future Students</a></li> <li><a href ="#">...</a></li> <li><a href ="#">Contact Us</a></li> </ul> </nav> </header>

1. Similar to before when creating this navigation bar 2. Remember to use a list 3. This time, we can use the nav element to contain everything together

Page 20: Creating HTML Pages

<header> <div id="quicklinks"> <ul> <li><a href ="#">Home</a></li> <li><a href ="#">About</a></li> <li><a href ="#">RGYou</a></li> <li><a href ="#">Staff & Current Students</a></li> <li><a href ="#">A to Z</a></li> </ul> </div> <img id="rgu_logo" src="robertgordonlogo.jpeg" alt="Robert Gordon University"/> <div id="seachbox"> <form> <p>Search</p> <input type="text" name="searchfield"> <input type="submit" value="Go"> </form> </div> <nav> <ul> <li><a href ="#">Areas of Study</a></li> <li><a href ="#">Future Students</a></li> <li><a href ="#">...</a></li> <li><a href ="#">Contact Us</a></li> </ul> </nav> </header>

Page 21: Creating HTML Pages

<main> <!-- Section 1 --> <section> </section>

<!-- Section 2 --> <section> </section>

<!-- Section 3 --> <section> </section> </main>

1. Split the <main> into 3 <section> tags

Page 22: Creating HTML Pages

<section> <h2>Search our courses</h2> <form> <input type="text" name="keywordbox" value="Enter Keyword"> <select> <option value="compsci">Computer Science</option> <option value="digmed">Digital Media</option> <option value="network">Computer Network Management and Design</option> <option value="other">Other</option> </select> <input type="submit" value="search"> </form> <ul> <li>Architeture, Construction & Surveying</li> <li>Business, Management & Accounting</li> <li>Engineering</li> <li>...</li> </ul> </section>

1. All of our content goes between the <section> tags

Page 23: Creating HTML Pages

<section> <h2>Search our courses</h2> <form> <input type="text" name="keywordbox" value="Enter Keyword"> <select> <option value="compsci">Computer Science</option> <option value="digmed">Digital Media</option> <option value="network">Computer Network Management and Design</option> <option value="other">Other</option> </select> <input type="submit" value="search"> </form> <ul> <li>Architeture, Construction & Surveying</li> <li>Business, Management & Accounting</li> <li>Engineering</li> <li>...</li> </ul> </section>

1. Create our header for this section

Page 24: Creating HTML Pages

<section> <h2>Search our courses</h2> <form> <input type="text" name="keywordbox" value="Enter Keyword"> <select> <option value="compsci">Computer Science</option> <option value="digmed">Digital Media</option> <option value="network">Computer Network Management and Design</option> <option value="other">Other</option> </select> <input type="submit" value="search"> </form> <ul> <li>Architeture, Construction & Surveying</li> <li>Business, Management & Accounting</li> <li>Engineering</li> <li>...</li> </ul> </section>

1. Create the form allowing people to search 2. use the text type for the first box 3. use a <select> for the second

1. Every option in the dropdown has to have an option 4. Use a submit type for the button

Page 25: Creating HTML Pages

<section> <h2>Search our courses</h2> <form> <input type="text" name="keywordbox" value="Enter Keyword"> <select> <option value="compsci">Computer Science</option> <option value="digmed">Digital Media</option> <option value="network">Computer Network Management and Design</option> <option value="other">Other</option> </select> <input type="submit" value="search"> </form> <ul> <li>Architeture, Construction & Surveying</li> <li>Business, Management & Accounting</li> <li>Engineering</li> <li>...</li> </ul> </section>

1. Create an unordered list to hold all of the links 2. use <li> to hold each one

spot the mistake…I should have done the following… <li><a href=“#”>My link text</a></li>

Page 26: Creating HTML Pages

<section> <h2>Search our courses</h2> <form> <input type="text" name="keywordbox" value="Enter Keyword"> <select> <option value="compsci">Computer Science</option> <option value="digmed">Digital Media</option> <option value="network">Computer Network Management and Design</option> <option value="other">Other</option> </select> <input type="submit" value="search"> </form> <ul> <li>Architeture, Construction & Surveying</li> <li>Business, Management & Accounting</li> <li>Engineering</li> <li>...</li> </ul> </section>

Page 27: Creating HTML Pages

<section> <img src="advertbanner.png" alt="Top UK University for Graduate Employment - HESA Destination of UK Leavers Survey 2013/14. Published by HESA, August 2015”/> </section>

1. Fairly easy section, just remember to include the alt text for the image.

1. If there is text in the image you should have the text in the ‘alt’ (screenreaders can’t read images)

Page 28: Creating HTML Pages

<section> <!-- Article 1 --> <article> </article> <!-- Article 2 --> <article> </article> <!-- Article 3 --> <article> </article> </section>

1. Split the 3 different articles into 3 different article tags and do each one

Page 29: Creating HTML Pages

<article> <h3>Postgraduate Open Evening</h3> <img src="newsarticle1.png" alt="Postgraduate students talking"> <p>Register to attend...</p> </article>

1. Contain everything inside the <article> tags

Page 30: Creating HTML Pages

<article> <h3>Postgraduate Open Evening</h3> <img src="newsarticle1.png" alt="Postgraduate students talking"> <p>Register to attend...</p> </article>

1. Put the article heading in <h3> tags

Page 31: Creating HTML Pages

<article> <h3>Postgraduate Open Evening</h3> <img src="newsarticle1.png" alt="Postgraduate students talking"> <p>Register to attend...</p> </article>

1. Remember to say where the image is (src) and what the images is (alt)

Page 32: Creating HTML Pages

<article> <h3>Postgraduate Open Evening</h3> <img src="newsarticle1.png" alt="Postgraduate students talking"> <p>Register to attend...</p> </article>

1. Put the text in a <p> tag

Page 33: Creating HTML Pages

<article> <h3>Postgraduate Open Evening</h3> <img src="newsarticle1.png" alt="Postgraduate students talking"> <p>Register to attend...</p> </article>

Page 34: Creating HTML Pages

<section> <!-- Article 1 --> <article> <h3>Postgraduate Open Evening</h3> <img src="newsarticle1.png" alt="Postgraduate students talking"> <p>Register to attend...</p> </article> <!-- Article 2 --> <article> <h3>Visit Us</h3> <img src="newsarticle2.png" alt="Sir Ian Wood Building"> <p>Your chance to visit...</p> </article> <!-- Article 3 --> <article> <h3>International Students</h3> <img src="newsarticle3.png" alt="Students deep in thought"> <p>Information for future...</p> </article> </section>

Page 35: Creating HTML Pages

<footer> <h2>Connect with Us</h2> <ul> <li><a href="http://www.facebook.com"><img src="facebooklogo.png" alt="Facebook"></a></li> <li><a href="http://www.twitter.com"><img src="twitterlogo.png" alt="Twitter"></a></li> <li><a href="http://www.youtube.com"><img src="youtubelogo.png" alt="Youtube"></a></li> <li>...</li> </ul> </footer>

1. Contain everything within the <footer> tags

Page 36: Creating HTML Pages

<footer> <h2>Connect with Us</h2> <ul> <li><a href="http://www.facebook.com"><img src="facebooklogo.png" alt="Facebook"></a></li> <li><a href="http://www.twitter.com"><img src="twitterlogo.png" alt="Twitter"></a></li> <li><a href="http://www.youtube.com"><img src="youtubelogo.png" alt="Youtube"></a></li> <li>...</li> </ul> </footer>

1. Create the heading for this section

Page 37: Creating HTML Pages

<footer> <h2>Connect with Us</h2> <ul> <li><a href="http://www.facebook.com"><img src="facebooklogo.png" alt="Facebook"></a></li> <li><a href="http://www.twitter.com"><img src="twitterlogo.png" alt="Twitter"></a></li> <li><a href="http://www.youtube.com"><img src="youtubelogo.png" alt="Youtube"></a></li> <li>...</li> </ul> </footer>

1. Create the set of links 2. <ul> to create the unordered list 3. <li> for each item 4. <a> to let every image link to somewhere 5. <img> to have the image itself

Page 38: Creating HTML Pages

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>RGU Homepage</title> </head> <body> <!--START OF HEADER --> <header> <div id="quicklinks"> <ul> <li><a href ="#">Home</a></li> <li><a href ="#">About</a></li> <li><a href ="#">RGYou</a></li> <li><a href ="#">Staff & Current Students</a></li> <li><a href ="#">A to Z</a></li> </ul> </div> <img id="rgu_logo" src="robertgordonlogo.jpeg" alt="Robert Gordon University"/> <div id="seachbox"> <form> <p>Search</p> <input type="text" name="searchfield"> <input type="submit" value="Go"> </form> </div> <nav> <ul> <li><a href ="#">Areas of Study</a></li> <li><a href ="#">Future Students</a></li> <li><a href ="#">...</a></li> <li><a href ="#">Contact Us</a></li> </ul> </nav> </header> <!--END OF HEADER --> <!--START OF MAIN --> <main> <section> <h2>Search our courses</h2> <form> <input type="text" name="keywordbox" value="Enter Keyword"> <select> <option value="compsci">Computer Science</option> <option value="digmed">Digital Media</option> <option value="network">Computer Network Management and Design</option> <option value="other">Other</option> </select> <input type="submit" value="search"> </form> <ul> <li>Architeture, Construction & Surveying</li> <li>Business, Management & Accounting</li> <li>Engineering</li> <li>...</li> </ul> </section> <section> <img src="advertbanner.png" alt="Top UK University for Graduate Employment - HESA Desintation of Uk Leavers Survey 2013/14. Published by HESA, August 2015"> </section> <section> <!-- Article 1 --> <article> <h3>Postgraduate Open Evening</h3> <img src="newsarticle1.png" alt="Postgraduate students talking"> <p>Register to attend...</p> </article> <!-- Article 2 --> <article> <h3>Visit Us</h3> <img src="newsarticle2.png" alt="Sir Ian Wood Building"> <p>Your chance to visit...</p> </article> <!-- Article 3 --> <article> <h3>International Students</h3> <img src="newsarticle3.png" alt="Students deep in thought"> <p>Information for future...</p> </article> </section> </main> <!--END OF MAIN --> <!--START OF FOOTER --> <footer> <h2>Connect with Us</h2> <ul> <li><a href="http://www.facebook.com"><img src="facebooklogo.png" alt="Facebook"></a></li> <li><a href="http://www.twitter.com"><img src="twitterlogo.png" alt="Twitter"></a></li> <li><a href="http://www.youtube.com"><img src="youtubelogo.png" alt="Youtube"></a></li> <li>...</li> </ul> </footer> <!--END OF FOOTER --></body> </html>

Page 39: Creating HTML Pages

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>RGU Homepage</title> </head> <body> <!--START OF HEADER --> <header> <div id="quicklinks"> <ul> <li><a href ="#">Home</a></li> <li><a href ="#">About</a></li> <li><a href ="#">RGYou</a></li> <li><a href ="#">Staff & Current Students</a></li> <li><a href ="#">A to Z</a></li> </ul> </div> <img id="rgu_logo" src="robertgordonlogo.jpeg" alt="Robert Gordon University"/> <div id="seachbox"> <form> <p>Search</p> <input type="text" name="searchfield"> <input type="submit" value="Go"> </form> </div> <nav> <ul> <li><a href ="#">Areas of Study</a></li> <li><a href ="#">Future Students</a></li> <li><a href ="#">...</a></li> <li><a href ="#">Contact Us</a></li> </ul> </nav> </header> <!--END OF HEADER --> <!--START OF MAIN --> <main> <section> <h2>Search our courses</h2> <form> <input type="text" name="keywordbox" value="Enter Keyword"> <select> <option value="compsci">Computer Science</option> <option value="digmed">Digital Media</option> <option value="network">Computer Network Management and Design</option> <option value="other">Other</option> </select> <input type="submit" value="search"> </form> <ul> <li>Architeture, Construction & Surveying</li> <li>Business, Management & Accounting</li> <li>Engineering</li> <li>...</li> </ul> </section> <section> <img src="advertbanner.png" alt="Top UK University for Graduate Employment - HESA Desintation of Uk Leavers Survey 2013/14. Published by HESA, August 2015"> </section> <section> <!-- Article 1 --> <article> <h3>Postgraduate Open Evening</h3> <img src="newsarticle1.png" alt="Postgraduate students talking"> <p>Register to attend...</p> </article> <!-- Article 2 --> <article> <h3>Visit Us</h3> <img src="newsarticle2.png" alt="Sir Ian Wood Building"> <p>Your chance to visit...</p> </article> <!-- Article 3 --> <article> <h3>International Students</h3> <img src="newsarticle3.png" alt="Students deep in thought"> <p>Information for future...</p> </article> </section> </main> <!--END OF MAIN --> <!--START OF FOOTER --> <footer> <h2>Connect with Us</h2> <ul> <li><a href="http://www.facebook.com"><img src="facebooklogo.png" alt="Facebook"></a></li> <li><a href="http://www.twitter.com"><img src="twitterlogo.png" alt="Twitter"></a></li> <li><a href="http://www.youtube.com"><img src="youtubelogo.png" alt="Youtube"></a></li> <li>...</li> </ul> </footer> <!--END OF FOOTER --></body> </html>

Remember, this is only the HTML (the structure) We still need to make the CSS (the design)

Page 40: Creating HTML Pages

Your turn…pick one of the following website and create the html for it

http://www.comp.rgu.ac.uk/

http://www.bbc.co.uk/news

http://www.bbc.co.uk/sport/

http://www.techradar.com/

http://www.metoffice.gov.uk/

http://mashable.com/

Page 41: Creating HTML Pages

want some feedback?send me a tweet!

@mike_crabb Lecturer in Web Development Robert Gordon University Scotland