Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Div Layer Help


15 replies to this topic

#1 galexcd

    Trap Grand Marshal Member

  • [MODERATOR]
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,331 posts
  • Gender:Not Telling
  • myCENT:39.82

Posted 13 May 2008 - 09:34 PM

Alright 20 credits goes to the first person to successfully solve my problem.

I need a div layer who's position is absolute to be 100 pixels from the top of the window and 0 pixels from the bottom without it going over. I have lost all faith in CSS because it cannot do this simple task that I require it to do.

Bonus points if you can get it to work on a div layer who's width isn't fixed.

EDIT: oh yeah It has to work in all browsers too...

Edited by galexcd, 13 May 2008 - 09:34 PM.


#2 kobra500

    Inane and Inept

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 602 posts
  • Gender:Male
  • Location:UK - Kent
  • myCENT:97.63

Posted 13 May 2008 - 09:39 PM

Quote

HAHA this is a first Alex needs help with a code... I'm only laughing mind cos I'm jealous and I too would not be able to do this but I get my laughs anyway (quoted since does not deserve credits and could be considered spam)

Edited by kobra500, 13 May 2008 - 09:41 PM.


#3 galexcd

    Trap Grand Marshal Member

  • [MODERATOR]
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,331 posts
  • Gender:Not Telling
  • myCENT:39.82

Posted 13 May 2008 - 09:52 PM

Quote

HAHA this is a first Alex needs help with a code...

Ehh... not exactly the first time. You should read some of my early topics when I was a little noob programmer and didn't really know anything. But anyway, I wouldn't really consider css as a programming language, or even as "code". Its more like "annoying text that makes your page not suck as much when you can get it to work but otherwise is just a pain in the..." well you get the idea.

#4 kobra500

    Inane and Inept

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 602 posts
  • Gender:Male
  • Location:UK - Kent
  • myCENT:97.63

Posted 13 May 2008 - 10:09 PM

I agree... if it were efficient I would sit down and use tables since they're easy but problem is you cant always do what you need to do!

#5 sonesay

    |||[ n00b King ]|||

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 958 posts
  • Gender:Male
  • Location:Auckland
  • myCENT:68.27

Posted 13 May 2008 - 11:28 PM

You need an expandable div that is set to limit of being 100pixels from the top of the window and goes all the way to the bottom? Sorry trying to make sure I understand correctly

#6 galexcd

    Trap Grand Marshal Member

  • [MODERATOR]
  • PipPipPipPipPipPipPipPipPipPipPip
  • 1,331 posts
  • Gender:Not Telling
  • myCENT:39.82

Posted 14 May 2008 - 12:33 AM

View Postsonesay, on May 13 2008, 04:28 PM, said:

You need an expandable div that is set to limit of being 100pixels from the top of the window and goes all the way to the bottom? Sorry trying to make sure I understand correctly

Yes thats exactly what I need. If you can make me something that works in all browsers to do this then you can have my 20 credits.

#7 coolcat50

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 303 posts
  • Gender:Male
  • Location:Random Places
  • myCENT:65.80
  • Spam Patrol

Posted 14 May 2008 - 03:34 AM

This sounds like you need some Javascript to insert dynamic CSS into the page and use AJAX to reload the page whenever the window size is changed. Or CSS I believe can do the trick. I know that you can stack another 100px div on top as a filler and have the other with a height of the rest of the window.

#8 sonesay

    |||[ n00b King ]|||

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 958 posts
  • Gender:Male
  • Location:Auckland
  • myCENT:68.27

Posted 14 May 2008 - 07:44 AM

This sounds like a challenge but I don't think I will be attempting this anytime soon. I've come across articles dealing with using JS to dynamically alter layouts on window resizing by the user but never looked into it. There would be no need for AJAX as JS alone should be enough since its all happening on the client side. If anyone comes up with a solution let us see!

#9 coolcat50

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 303 posts
  • Gender:Male
  • Location:Random Places
  • myCENT:65.80
  • Spam Patrol

Posted 14 May 2008 - 03:34 PM

Well, here is a small code that could do it. I am not sure if it works in all browsers. Check it. It uses a margin to lower it by 100px.

CSS:
* { padding: 0 0 0 0; }
//Must set padding to 0 for Opera.

body {
//Set top margin to be 100px
margin-top:100px;
//Set rest of margins to be 0
margin-left:0px;
margin-right:0px;
margin-bottom:0px;
}

.lowereddiv {
//Set height to fill rest of page
height:100%
}


#10 jlhaslip

    Insert Custom Title Here

  • [MODERATOR]
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,040 posts
  • Gender:Not Telling
  • Location:Linux, DOS and Windows…the good, the bad and the ugly
  • myCENT:81.07
  • Spam Patrol

Posted 14 May 2008 - 03:48 PM

I don't have time to work with the code, but check this out:

http://www.webmaster...orum91/3429.htm




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users