It's nice to imagine that would work, but it just doesn't behave that nicely.
If you make the "main_section" of less width, do they sit beside each-other OK?
If I change it to 547px in width. It fits, only thing is that I got these instructions for school. And they told me to make them according to these widths.
Hello crazyponytail,
It always seems like the box model is the hardest concept for new coders to grasp. See the box model here. The box model says that whatever you put inside an element cannot be larger than that element. margin/padding/border all count when figuring width/height.
When you add that 1px border to 550px wide section#main_section, you make it 552px wide.
If you need those borders for the final product, you will need to adjust your widths. If you are just using borders to make your elements visible during development, a different background color on each element works much better since the color will not affect the width.
There is no need for positioning in your layout yet. I would suggest using using floats instead.
If I change it to 547px in width. It fits, only thing is that I got these instructions for school. And they told me to make them according to these widths.
Hmm, you didn't mention it was school work in your original post. This board has rules about doing homework.
Didn't your instructor mention the box model at all?
Hello crazyponytail,
It always seems like the box model is the hardest concept for new coders to grasp. See the box model here. The box model says that whatever you put inside an element cannot be larger than that element. margin/padding/border all count when figuring width/height.
When you add that 1px border to 550px wide section#main_section, you make it 552px wide.
If you need those borders for the final product, you will need to adjust your widths. If you are just using borders to make your elements visible during development, a different background color on each element works much better since the color will not affect the width.
There is no need for positioning in your layout yet. Look at how easy it can be -
Thank you, I will analyze what you have done and learn something from it!
Hmm, you didn't mention it was school work in your original post. This board has rules about doing homework.
Didn't your instructor mention the box model at all?
Im doing a distance course, we dont have any classes. I have a book and thats it and the internet of course.
So well, its not really like I had the chance to be at a class that I didnt attend, this is my class. Trying to learn it myself. (And I dont like books so I rather use youtube guides, information on forums etc etc.)
And now you removed your code, so I cant analyze it.
Im really not trying to cheat here.
Well well, you pointed me into the right direction at least.
Last edited by crazyponytail; 11-13-2012 at 03:40 PM..
And yeah, the other problem is still hanging. How do I set them to 250px and 550px without any of them overlapping? What am I doing wrong here?
Another approach for a two column layout is to set a width and float one column and margin the other over with no width. That lets the second column take all the room left that the floated column didn't use.
Im doing a distance course, we dont have any classes. I have a book and thats it and the internet of course.
So well, its not really like I had the chance to be at a class that I didnt attend, this is my class. Trying to learn it myself. (And I dont like books so I rather use youtube guides, information on forums etc etc.)
And now you removed your code, so I cant analyze it.
Im really not trying to cheat here.
Well well, you pointed me into the right direction at least.
Sounds like the way I learned
Sorry for yanking that snippet. I'm not trying to be a jerk at all! I just didn't want it copy/pasted into your assignment and handed in without your understanding how it works.
A lot of info in this thread. I would suggest studying that box model and floats first. Like I said, the box model is very important and seems to usually be quite the stumbling block in the learning curve.
Sounds like the way I learned
Sorry for yanking that snippet. I'm not trying to be a jerk at all! I just didn't want it copy/pasted into your assignment and handed in without your understanding how it works.
A lot of info in this thread. I would suggest studying that box model and floats first. Like I said, the box model is very important and seems to usually be quite the stumbling block in the learning curve.
Thank you. I am not into the business of cheating. I will read the box model and floats. I had the feeling I was missing out on something.