of the page shows at the top of the browser window or on the tab of a browser window, and in the search listing for a site. Let’s pick something that will make sure people know what the site is, and what page they are currently on. Something like «Whitewater Rafting Vacations | Dry Oar Boating | Home».

Getting Started: Create the Home Page in HTML

If you completed the Software setup activity you should already have an html file ready called index.html. It should look something like this:

Naming files for the web

  • Always name the first page of your site index.html
  • Most web hosts are case-sensitive which means there is a difference between I ndex.html and index.html
  • So. Make your filenames all lowercase to avoid problems with case sensitivity.
  • Avoid spaces and other special characters in your filenames (a-z, 0-9, -, and _ are all safe to use)

Inspect the

Change the title

Let’s go ahead and change the title next. The

Note!

We will NOT be adding colors and other styles this week. Our only goal is to get all of the content onto the page that is shown on the wireframe. Our Page will NOT look like the wireframe when we finish this week. Each week will get us closer, but our page will not look exactly like the wireframe for several weeks, so patience will be required 🙂

«Framing» with semantic elements

Building a website is actually a lot like building a house. You start with a blueprint (wireframe) and then you build the foundation and frame for the house. We have already built the foundation. We did that when we added the , , and elements above. The framing takes the rooms outlined on the blueprint and creates a real space to put them. We need to do the same thing for our webpage, except for instead of rooms we are looking at content areas. The way we «frame» in our webpage is by looking carefully at our wireframe to see what «rooms» we have. Then we use some special HTML tags to define them.

Читайте также:  Скролл при нажатии css

Take a moment to review the wireframe again to help remember what we are trying to do. Remember that I mentioned above that we are looking right now at content areas. elements on the page that are related and grouped. The wireframe has colored boxes to help you to see those relationships. We need to add some markup to create those containers in our html. Html has several tags specifically for this purpose. Some have specific semantic meanings and others don’t. We should always try and use the ones with meaning whenever we can. Here is a list of some of the more common of these tags: , , , , , , , , , and . Last week you were asked to review a short article on HTML Semantics . There is a chart there that does a nice job of showing how those elements might be used in a simple site layout. Take a minute to go check it out again. All of these elements behave the same in the browser except for , but they are used to show different sections of the page. Try to use the more specific ones first, using a generic only if none of the others seems to apply to the content you are boxing in.

Add HTML elements to your body to start outlining content areas. The first we need is at the top of the page. Notice that there is a box around the logo and navigation bar. Those elements are related and form the header of the page. Lucky for us if you look in the list of tags above you will see that there is a

Читайте также:  Javascript this in promise
tag! Not only that but the starter code already has one. Inside of the header you can see a second box around the links for the navigation. Again after reviewing the list above we see a tag. perfect! And again it looks like the instructor was a little too generous with the starter code because you already have one! Next let’s add an area where the main content for this page will go. On a normal site the header and footer will stay the same across pages. but the central content will change from page to page. We need a box to hold that. The tag was built for just this use. Add a element to your page right below the

The first thing we need inside our new element is a banner image that will stretch all the way across the screen. Let’s add some html to hold that. In this case a simple is probably the right answer.

Tip!

There will be a lot of code examples in this and other lessons. Avoid the temptation to just copy/paste them into your page. Type them out! This might seem like a bother, but you will remember the HTML and CSS we use much better if you do 😉

Below that banner is a bunch of content. It is separate from the banner, but related. Let’s use an HTML element to group the content in that section together. Another

would work well again. Notice that the
s we created for the banner and the rest of the main content look just the same! We need a way to distinguish between the two elements. The common way to do this in HTML is with a class or id attribute. Lets add unique classes to each of those divs that describe what will be inside them. For example for the banner lets add class=»banner-box» and for the rest of the content add class=»home-grid» (this name will make more sense later). Finally we need one more container on our page. This one will hold the footer information. Again if you refer to the list of semantic elements above you will see a element. Add one below
. At this point my looks like this:

You may have noticed the lines in my code above that are in grey. They are called comments. notes to yourself that the browser will ignore. Comments start with and everything in-between will be ignored. Comments are a great way to remind yourself what you were thinking when you did something in your page.

Adding content.

Finding your own Images

  • Make sure the image is not restricted for use. These would include images from other whitewater rafting company sites and photographer’s sites.
  • You can have Google help you try to avoid those and find images that are free to use by searching something like rafting in Google. then select the Images tab. At the top of the screen you will see a Settings option. Select Advanced Search . Towards the bottom of that page is a Usage Rights option. Select «free to use or share, even commercially»
  • Many of the images you will find will be very large! Don’t worry about that this week, we will learn how to correct that next week.

With that we should now have all of the «framing» done on our webpage. We have a place defined now for all the content that needs to be on the page. With that done we are now ready to actually add it! Remember to refer often to the wireframe as you are adding the content. The instructions will make much more sense if you are looking at the blueprint!

Header content

Let’s work on the header first. Visit the image links above and find the logo you would like to use. Add the tag to your page inside the . Remember that the tag has 2 required attributes. alt and src . src should indicate the location of the image and alt=»» should contain a short description about the image and is used primarily for the screen readers that the visually impaired use to browse the web. This image is already the right size and is on a web server, so we just need to figure out what its URL is to add it to our page. Your browser makes it really easy to do that. If you click with the right mouse button on any image in the browser your computer will offer you several actions you can take. The one we are interested in right now is «Copy Image Address». Copy the address for the logo image and paste the result into the src attribute in our image. the final tag should look something like this:

 

Indentation

You may have noticed something else about my code as well. Notice how I am indenting my HTML elements to help me clearly see which elements are inside of other elements. As your page gets larger this becomes more and more important. Take a little time to keep your code in order. you will be happy you did later on.

Finish the Menu

    element with two
  • children. Add additional
  • elements for each link that shows in your siteplan. I would let the aboutme.html link drop to the bottom of the list. The home page, index.html, should always be first in the menu. Your should look something like this:

Add a Banner

Add the Main content

Next we have a collection of a bunch of headlines paragraphs and images. Start right below the banner in the wireframe (you still have that open right?) and read left to right top to bottom to add the content. All of these elements will go inside of the home-grid div. Using the tag add the first headline to the page inside of the first home-grid . (There is a headline on the wireframe you can use. or you can make up your own). Give this a name with a class . Call it home-headline-1 Then use a

tag to add the following text: (or something similar. feel free to edit this 🙂 ) inside of that same . Give it a class as well. Call it home-paragraph-1 We believe that there is nothing like a river trip for relaxing. That is why we subscribe to the dry oar philosophy of boating. Keeping your oars dry for us means taking time to look around and notice the beauty that surrounds the rivers we love. Finally choose another picture from those provided and add it after the paragraph. Add a class to it as well of home-right-img Here is an example of how your code should look:

 

We run Rivers to relax.

We believe that there is nothing like a river trip for relaxing.

peaceful evening shot of a river

Check your work to make sure that everything is showing up correctly. Then add another headline, paragraph, and image. Make sure to use different names for their classes. I would recommend: home-headline-2, home-paragraph-2, home-left-img . Text for the paragraph is below: That doesn’t mean we don’t also like rapids. Opposites in all things after all. We believe that that tenseness that comes when you are looking down the tongue of a big string of waves makes you appreciate the calm beautiful water that always follows even more.

Using personal images

You may be wondering how you might use a picture of your own on a website. It’s actually pretty easy. An image needs to be on a webserver in order to be used on a website. Glitch is our webserver, so if you want to add a picture of your own you just need to upload it into Glitch as we did for the About Me activity. You might want to take an early look at the Optimizing Images activity before you do this though.

Finishing up the main content

The next section is a bit different. The headline and paragraph there are going to be kept together when we do our layout. Whenever you want to move multiple elements together you should group them by placing them inside of another element. Let’s use a element for this. Add a with a class of home-paragraph-3 inside and at the bottom of the .home-grid element, then add a headline and paragraph inside of that element like we did above. We don’t necessarily have to add classes to this and

since we will learn how to find them based off of their parent later. But you can add them if you would like. Here is the text for the last paragraph: We invite you to come relax with us on one of the amazing rivers we visit. Check out our trips and let us know which one best suits you. We’re waiting to hear from you! And here is what the HTML for this portion of the page should look like.

 

Come Run with us.

We invite you to come relax with us on one of the amazing rivers we visit.

Finally let’s add the content to the

. The copyright comes first. Put it into the first element that you should have added in your
. To make the copyright symbol we use a special code, there are many of these but we will just learn this one today: © Place that right before the 20XX so it will look like this:

Let’s go ahead and add your name and section as part of the footer as well. So the final html for the footer section should look something like this:

 

© 20XX Dry Oar - FirstName LastName - Section

Make sure to replace the «XX» with the current year for the copyright! We will add the icons for the social media links later.

One more reminder! Our only goal is to get all of the content onto the page that is shown on the wireframe. Our Page will not look like the wireframe at this point. Each week will get us closer, but our page will not look exactly like the wireframe for several weeks, so patience will be required 🙂

Verify

Make sure to view your web page online to make sure your changes are correct. Once verified, submit the URL from your browser that you use to view your page to iLearn. Also make sure to validate your html. Review the Troubleshooting Activity from this week if you have forgotten how to do this.

Always check that URL before you submit your assignments in Ilearn to make sure that all your changes show.

Источник

Оцените статью