CSS Positioning
Moderator: Sigma
CSS Positioning
Paging web designers for some help
Just have some absolute / relative / float q's and hoping for at least one a
Just have some absolute / relative / float q's and hoping for at least one a
Well, I guess my question is: what is the best practice for positioning different elements on a web page? Should I use absolute or relative positioning?
Let's say I have this for a box:
Is it possible to reuse this to create another box that does not end up in the same spot as this box? If so, how would I change that bit of code?
I'm not really sure how to ask this question.
Let's say I have this for a box:
Code: Select all
#navbar {
position: absolute;
left: 0px;
padding: 10px;
border: solid black 1px;
border-left: 0px;
}
I'm not really sure how to ask this question.
So you want to add another box with the same appearance, just in a different place? Assuming so... Then what you need to do is separate the positioning properties from the appearance properties. Starting with your first definition, we'll do the separation:
Now add the other box in there... I'll call it secondbox:
As for the positioning code itself, you'll have to say a bit more about where you want it to go - absolute and relative positiong both have their uses.
Code: Select all
#navbar {
position: absolute;
left: 0px;
}
#navbar {
padding: 10px;
border: solid black 1px;
border-left: 0px;
}
Code: Select all
#navbar {
position: absolute;
left: 0px;
}
#secondbox {
/* Add the positioning stuff here */
}
#navbar, #secondbox {
padding: 10px;
border: solid black 1px;
border-left: 0px;
}
I'm going through another reading / rethinking / information gathering stage. Do you guys know of any books that are good for learning about web design, page layout, xhtml, css? Any or all of those topics, if you guys could recommend something, I would appreciate it. If you have a website that you think I may not have seen, I would like to hear about it too.
I'm back
http://nchase.blogspot.com
I like what I've got going so far. There is a bug in IE though (lol IE). #contentwrapper appears above the title area. If I try to add a border in Firefox, the same thing happens. If anyone has insight into this I would appreciate feedback. Otherwise it's cool guys
http://nchase.blogspot.com
I like what I've got going so far. There is a bug in IE though (lol IE). #contentwrapper appears above the title area. If I try to add a border in Firefox, the same thing happens. If anyone has insight into this I would appreciate feedback. Otherwise it's cool guys
always use ems for text sizing. ems are a relative unit and so if the user has their default browser font size up high then your page should still maintain it proportions i.e. your paragraphs won't suddeny be bigger than your h1.
if you going for a fluid layout then use ems or percentage for element size too.
all the above examples won't work for more than one element cos the # indiactes am id and ids can only be used once per page. you need a class which is indicated by a .
check htmldog.com for some good explanations. other than that i don't think i ever really seen a css tutorial
if you going for a fluid layout then use ems or percentage for element size too.
all the above examples won't work for more than one element cos the # indiactes am id and ids can only be used once per page. you need a class which is indicated by a .
check htmldog.com for some good explanations. other than that i don't think i ever really seen a css tutorial
-
- Posts: 1099
- Joined: Tue Feb 10, 2004 7:02 pm
- Location: Mpls
- Contact:
http://www.w3.org/Style/CSS/learning
this is probably obvious, but it's always a good idea to check out the W3C for info and help.
this is probably obvious, but it's always a good idea to check out the W3C for info and help.