Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with CSS absolute/relative postioning 1

Status
Not open for further replies.

Jimuniguy

Technical User
Mar 6, 2002
363
GB
Hi,

Problem
I need to position the form about 140 pixels AFTER banner, but I dont seem to be getting this right with the code below:

Code:
<div align=&quot;center&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: 40px; font-weight: bold; color: #000000; position: absolute; visibility: visible; left: 140px;	top: 100px;&quot;> 
&nbsp;&nbsp;&nbsp;Help Me</div>
  
<div style=&quot;position: relative;	visibility: visible; width: 80%; top: 100px;&quot;><form><p>This really neads to go about 140 pixels down from the banner above</p></form>

Can someone tell me what I am missing please?

Thank you

James
 
How about creating a container DIV for these which has an absolute position of top: 100px. The first DIV in the container could have a relative position of top: 0 and the second could have a relative position of top: 140px.

Either that or place the second DIV with an absolute position of top: 240px

Tony
reddot.gif WIDTH=300 HEIGHT=2 VSPACE=3

 
Hi,

Yes i have thought of that, but the problem is, that banner can be changed (text size I mean) and hence could overflow onto that form, and hence I always need it to be 140px below that banner.

Any other thoughts?

James
 
Hi,

Your code idea still does not work:

Code:
<div style=&quot;postion: absolute; top: 100px;&quot;>
<div align=&quot;center&quot; style=&quot;font-family: Arial, Helvetica, sans-serif; font-size: 40px; font-weight: bold; color: #000000; position: relative; visibility: visible; left: 140px;    top: 0px;&quot;> 
   Help Me</div>
  
<div style=&quot;position: relative;    visibility: visible; width: 80%; top: 100px;&quot;><form><p>This really neads to go about 140 pixels down from the banner above</p></form></div></div>

Can you please tell me why it does not work?
 
how about...
Code:
<DIV STYLE=&quot;position: absolute; top: 100;&quot;>
  <DIV ALIGN=&quot;center&quot; STYLE=&quot;font-family: Arial, Helvetica, sans-serif; font-size: 40px; font-weight: bold; color: #000000; position: absolute; visibility: visible; left: 140px; top: 0px;&quot;> 
   Help Me
   </DIV
  
  <DIV STYLE=&quot;position: relative; visibility: visible; width: 80%; top: 140px;&quot;>
  <FORM><P>This really neads to go about 140 pixels down from the banner above</P></FORM>
  </DIV>
</DIV>

This would put the form 140px below the bottom of your banner - or do you want the form to be 140px from the top of your banner??
Tony
reddot.gif WIDTH=300 HEIGHT=2 VSPACE=3

 
Hi,

Cheers. That works a treat.

Is it possible to do it from the bottom of the banner at all?

Cheers

James
 
oops - thought the last one did that but I forgot to change the position type of the first nested DIV. Both nested DIVs should have position: relative;


Code:
<DIV STYLE=&quot;position: absolute; top: 100;&quot;>
  <DIV ALIGN=&quot;center&quot; STYLE=&quot;font-family: Arial, Helvetica, sans-serif; font-size: 40px; font-weight: bold; color: #000000; position: relative; visibility: visible; left: 140px; top: 0px;&quot;> 
   Help Me
   </DIV>
  
  <DIV STYLE=&quot;position: relative; visibility: visible; width: 80%; top: 140px;&quot;>
  <FORM><P>This really neads to go about 140 pixels down from the banner above</P></FORM>
  </DIV>
</DIV>
Tony
reddot.gif WIDTH=300 HEIGHT=2 VSPACE=3

 
Hi,

Ah ok, one last question then.

How to I get the page to dynamically change??

E.g. I put all this in, but then if the page is smaller then the overall layout, the page will not scroll to show it all like a normal HTML page would do.

Does that make sense?

James
 
Hi,

True I could do.

The question I ask is that the page text can dynamically change style, and I need for all the items to be free of each other, regardless of text size, but I now face this problem that the page will not dynamically change shape like a normal static HTML page would do.

Any other thoughts?

James
 
Hi,

Think of it like this tony.

Image you have a page which is 1000x800

When you make that page window smaller to say 800x600, in a normal Web page, the browser will put scroll bars on the sides enabling you to scroll the page.

Why will it now NOTscroll to show the parts which have been clipped by the page?

I need it to scroll

Cheers

James
 
but if you set the height of the container DIV so that it is greater than the height of all its nested components then it should scroll when the page size is reduced.

Granted - this is not a dynamic solution but it should work if your content is not going to change drastically. Tony
reddot.gif WIDTH=300 HEIGHT=2 VSPACE=3

 
Hi,

True it does work, but then I get a ugly scroll bar which is grey out till its used.

Any thoughts on how to avoid that?

And how mind blowing is this for a friday afternoon? I should be outside with ice cream and a cold beer enjoying the women Scenery :D Not fiddling with dynamic pages.

Cheers

James
 
Here is another query too.

The page contains a form, which does make the window dynamically readjust itself, but the scroll feature will not work, the menu just makes the scroll bars appear on the window frame.

:-(

James
 
&quot;but then I get a ugly scroll bar which is grey out till its used.&quot;

Change the scrollbar colours so it blends in::

#qwert {
scrollbar-face-color: #ffffff;
scrollbar-highlight-color: #ffffff;
scrollbar-shadow-color: #000000;
scrollbar-3dlight-color: #000000;
scrollbar-arrow-color: #000000;
scrollbar-track-color: #ffffff;
scrollbar-darkshadow-color: #dcdcdc;
}

You can specify the above for the page or just for a single div.


É

endamcg-logo1b.gif

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top