June 18, 201214 yr Hello I am learning how to create/design websites and am really stuck on layouts! Can any one help me with code for creating a basic web page layout. i.e. Header, Nav bar at top, two columns in the main section and a footer. I have some simple code I have attached along with the css file. Like I said i am very new to this so its very simple! Any help on expading this and creating the columns and footer would be amazing. Thanks Practice.html style.css
June 18, 201214 yr From your HTML I can see that you know what a <div> is. From that we can create a website. I'll teach you what margins are, passings, width, height, borders and colours. Margins are used to position you website from the four sides. Top, Bottom, Left and right. So, If I wanted to have a 10px gap from the left, I would use this code; html <div id="wrapper"> </div> You already know this, so moving to the CSS CSS #wrapper { margin-left:10px; } This code will create a 10px gap from the left, but lets advance on this with a background colour, a border and also some dimensions for the size. CSS #wrapper { background-color:#FFFFFF width:600px; height:900px border: 1px solid #000000; margin-left:10px; } Paddings are used for content. When putting content in a div box they are automatically pushed up to the box, so having a little padding moves it away, for example CSS #wrapper { background-color:#FFFFFF width:600px; height:900px border: 1px solid #000000; margin-left:10px; padding:10px; } If you want to change the margins to you have them at the top, botton, left and right just adapt the code so it looks like this; margin-left: margin-right: margin-top; margin-bottom; I hope this helps, and for a more in-depth look at a div box, just go here; http://www.w3schools.com/css/css_boxmodel.asp Edited June 18, 201214 yr by Tweezy
June 18, 201214 yr Author Thank you for this, helps alot! Positioning is the main problem where I have been getting stuck. So if I was to create two columns in the main section would I create two separate Div tags for these or?
June 18, 201214 yr Hi Peart, try putting your code online, http://jsfiddle.net/ works well, for more responses. Don't worry about positioning, it trips everyone up at the beginning, it'll click eventually. You'll have plenty of "wtf" moments This is a nice explanation to css positioning. Try to get your head around the box model, Google it, it'll help once you get it. And yea, sure, that'll create two columns. Goodluck, ~evu. Edited June 18, 201214 yr by evu
Create an account or sign in to comment