HTML/CSS Content and Side Pane Design Layout
Submitted by Yorkiebar on Monday, September 16, 2013 - 08:15.
Introduction:
Hello and welcome to my tutorial on how to create a basic website layout in which you have a wide content section for the page content and a thiner side content pane for widgets.
Steps of Creation:
Step 1:
First we need to create the basic HTML file and the CSS file:
HTML File:
Note: We don't have anything to put in to our css file yet but I have called mine theme.css and it is in the same directory as my index.html file.
Step 2:
Next we need to link the HTML file to our CSS file and generate random content for our page...
Step 3:
Ok. So now we have our content with the class of "content" and our side pane as the class of "side". Now we can give it some CSS...
First we set the margin and padding of everything's defaults to 0pixels just in case the browser the user is using has a different preset.
Next we set the body width to 100% and give it a background colour - you'd think the body is 100% width by default, right?
After that we set our .content (the div with the class of "content") width to 78% and float it to the left of the browser page. We do the opposite with the .side pane to send it to the right of the browser and give it a left border so we can see where it beings (This can look nice if implemented properly but I am just using it as a clear tutorial).
Notice how we only gave our elements a total of 98% width in a 100% parent (body)? That's because I gave it a 2% width gap between them, you can remove this and add in padding if you want.
Project Complete!
That's all there is to a content and side pane website design. Obviously mine doesn't look nice because I haven't taken the time to make it look amazing as this is only an example but you can make great websites with this layout. Below you will find the download for both the files.
- <!DOCTYPE html>
- <html>
- <head>
- </head>
- <body>
- </body>
- </html>
- <!DOCTYPE html>
- <html>
- <head>
- <title>Content and Side Pane Design</title>
- </head>
- <body>
- <div class='content'>
- <p>This is my page content and if this was legit content it would be at
- lot more appealing and larger...This is my page content and if this was
- legit content it would be at lot more appealing and larger...This is my
- page content and if this was legit content it would be at lot more
- appealing and larger...This is my page content and if this was legit
- content it would be at lot more appealing and larger...This is my page
- content and if this was legit content it would be at lot more appealing
- and larger...</p>
- </div>
- <div class='side'>
- <p>Login Widget</p>
- <p>This is where my widgets would go.</p>
- </div>
- </body>
- </html>
- * {
- margin: 0;
- padding: 0;
- }
- body {
- width: 100%;
- background-color: #E2E2E2;
- }
- .content {
- width: 78%;
- float: left;
- margin-left: 0;
- }
- .side {
- width: 20%;
- float: right;
- margin-right: 0;
- border-left: 3px solid #9CDDFB;
- }
Comments
Add new comment
- Add new comment
- 90 views