This is a discussion on "relative Positioning Problem" within the Web Page Design section. This forum, and the thread "relative Positioning Problem are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
relative Positioning Problem
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
relative Positioning Problem
Hi,
I seem to be struggling to get to grips with some basic concepts relating to DIVs and hope that someone might be able to point me in the right direction with a couple of issues. Issue 1) I would like the "box" in its containing div, to be positioned where I specify (in relation to the containing div). This is actually as it's setup now, however, there is a space created above the word "Title" that seems to be taken up by the "box" (i.e. its source code position), even though the "box" is positioned elsewhere using css. The "box" needs to be relative to the containing DIV, so it needs to be where it is now in the source code (or does it?), so how can I get rid of the space above the word "Title" yet still position the "box" relative to the containing DIV? Issue 2) Hopefully an easy one Many thanks for any help.
Last edited by karinne; Jun 7th, 2007 at 18:36. Reason: Please use [code]...[/code] tags when displaying code! |
|
|
|
#2
|
|||
|
|||
|
Re: relative Positioning Problem
First try to separate the layout from the content. I mean create a css file and define styles there
|
|
#3
|
|||
|
|||
|
Re: relative Positioning Problem
First of all each div that is a separate container should be labeled <div id="box"></div>
Then to do a box inside a box (nested div) you can use a div id but I'll use a div class for demonstration purposes so you can see both.
Play with this and see what I did. This might shed some light on your questions. If you have more questions or I misunderstood the question, let me know! Last edited by Lchad; Jun 7th, 2007 at 21:49. Reason: oops the code was a bit wrong |
|
#4
|
|||
|
|||
|
Re: relative Positioning Problem
Quote:
Thanks anyway |
|
#5
|
|||
|
|||
|
Re: relative Positioning Problem
Thanks Lchad for the reply. The main issue is actually not the alignment at all, It's the odd space that appears above the content.
As I understand it, for the insidebox to be relative to the main container (which I need it to be), the DIVS must be nested as such in source code (which they are). For some reason, this creates space above OTHER content in the main container, as though it has been allocated to the insidebox DIV (even though its positioned elsewhere). ![]() So my question is; Why is this space being allocated to a DIV that is not there? This is not a browser issue since it appears exactly the same in all browsers I have tried it in. Many thanks for any help Mark |
|
#6
|
|||
|
|||
|
Solved!
Hi,
Just in case it helps anyone else, I have solved the issue. Containing DIV: setting this to "position:relative;" ensures that any elements within this DIV will be positioned relative to ITSELF (I didnt know that This means that any nested divs can then be positioned using ABSOLUTE and importantly, they will take their TOP and LEFT positions from the Containing DIV. SO...Since the nested elements are using "position:absolute;", they do NOT TAKE UP ANY SPACE OTHER THAN the position they are set to. So the ammended code produces the desired result..
Last edited by karinne; Jun 8th, 2007 at 12:37. Reason: Please use [code]...[/code] tags when displaying code! |
|
#7
|
|||
|
|||
|
Re: relative Positioning Problem
Glad you figured out your issue!
|
![]() |
| Tags |
| css, positioning |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| CSS Relative <DIV> Size Problem | andycain | Web Page Design | 6 | Nov 29th, 2007 14:32 |
| positioning - relative or absolute? | Web Page Design | 13 | Nov 8th, 2007 16:00 | |
| CSS positioning help - relative to background image | sj2as | Web Page Design | 1 | Sep 12th, 2007 01:27 |
| Background color problems with relative positioning | kirkham85 | Web Page Design | 3 | May 12th, 2007 22:53 |
| relative position problem | antonyx | Web Page Design | 12 | Dec 30th, 2005 21:19 |