Using CSS to create a 100% width footer
Contents
The footer is an often underutilized component of a successful website. In this tutorial you’ll learn how to use CSS to create a 100% width footer to take advantage of available screen sizes with larger browsers.
Technical Information
This tutorial uses id selectors for Layout positioning. An id selector specifies a style for a single element, it can only be used once per page. You can reuse the same id’s on multiple pages however. Also, HTML5 Dynamic will need to be set in the Site options. From the Tools menu > Options > Site Options > change the HTML output type to HTML5 Dynamic.
- Create a new blank website, name it footer
- Click to the Page view of the Home page
- Temporarily move the text navigation and Made With NetObjects badge from the bottom Master Border into the Layout area.
- Expand the margins of the bottom Master Border to 160 pixels
- Draw a Layout region onto the Master Border stage
- Adjust the dimensions to 760x160 pixels
NetObjects Tip: You can view the width and height of any object in the bottom right corner of the application
- Fill the Layout region with an appropriate color, try #999999
- With the Layout region selected, click to the Grid Inspector
NetObjects Tip:You can enable the Grid Inspector window under the View menu > Grid Inspector
- Look for the id field, change the name to footer
Drawing the Content Layout region
When a centered page is used, place your content inside footerContent. If your pages are not centered then you can skip to Adding CSS.
- Draw a new Layout region inside the footer Layout
- Set the dimensions to 760x120 pixels
- With the Layout region selected, click to the Grid Inspector
- Look for the id field, change the name to footerContent
Adding CSS
Now that our Footer is in place and the id’s have been named correctly, we can move on the Style view for the last portion of the tutorial. Click to the Style view now.
- Click the CSS Code tab to access the CSS for the site
- Add the following snippet of CSS after the Body element.
float: left;
position: absolute;
left: 0;
width: 100%;
height: 165px;
}
For centered pages add this snippet as well:
position: absolute;
left: 50%;
width: 960px;
margin-left: -480px
}
When you’re comfortable with the steps, you can apply these techniques to your own website projects.