Solved

Make a layer centered

Posted on 2007-04-07
8
356 Views
Last Modified: 2013-11-19
Hello.

I would like to make a layer centered.

See this page:
http://www.cybersouk.ch/luke/accueil.html
The problem is when the window is resized horizontally, the text is not centered. It is specially visible on a big resolution screen.

I've found a script which is supposed to make a layer centered:
http://www.dhtmlshock.com/layer-effects/CenterLayer/default.asp

I've tried to modify my page according to the instruction provided but I cannot make it work.

Can you help me to make this layer centered, using this script or another way which is up to you?
All I need, in fact, is the scrollbar on the right of the text. There would be more text in the future. Maybe there is a more simple way to acheive this than a layer?

Thanks!
0
Comment
Question by:ornicar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 5

Expert Comment

by:rucky544
ID: 18869315
would be easier to make it relatively positioned inside the table cell you want it to sit in.
0
 
LVL 29

Accepted Solution

by:
Pravin Asar earned 100 total points
ID: 18869531
<div  align="center">
<div align="center" style="width: 400px; height: 200px; border: black solid 1;">
THIS IS A CENTERED LAYER WITH FIXED BORDER.
<br>Resize window and see how it centers itself.
</div>
</div>
0
 
LVL 9

Author Comment

by:ornicar
ID: 18869945
Yes, I've tried to make it relative, and I've tried your tag <div align="center" style="width: 400px; height: 200px; border: black solid 1;">

The result is funny, but promiding. It stays centered, but the whole frame with the border displays with a gap. It moves correctly when resizong the window, but I lost the scrollbar, which is important, and there is this gap: Please look at:

http://www.cybersouk.ch/luke/accueil2.html

Maybe I should keep something from the original tag, which was:
<div id="centerLayer" style="position:absolute; width:596; height:350; z-index:1; left: 210; top: 150; overflow: auto; padding: 5px;" class="contenu">

I don' know much about this coding. Which is defining the scrollbar?

And how make this gap disappear?

Thank you, pravinasar. at this point, I have a clue.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Assisted Solution

by:NickVd
NickVd earned 100 total points
ID: 18870564
I haven't seen the page or the source, but from my css experience I can tell you that It's impossible to have a fluid, centered, and ABSOLUTELY positioned element. (without using javascript).

However, If you want only want to horizontally centre and element you can simply set it's left and right margins to 'auto';

<html><body>

<div style="border:1px solid red; width: 75%;margin:0 auto;">This content is fluid and horizontally centered.</div>

</body></html>
0
 
LVL 29

Assisted Solution

by:rdivilbiss
rdivilbiss earned 50 total points
ID: 18873307
0
 
LVL 29

Expert Comment

by:Pravin Asar
ID: 18875767
Just after div tag, you have couple of <td> elements

<div id="centerLayer" style="position:absolute; width:596; height:350; z-index:1; left: 210; top: 150; overflow: auto; padding: 5px;" class="contenu">

To validate your HTML code, use validator sevice at

http://validator.w3.org/


0
 
LVL 9

Author Comment

by:ornicar
ID: 18875976
Thank you for this link. There is a lot of errors in this page :D
It doesn't find the <td> but I can see there is a problem here. There is also an orphan </table>

Please allow me a little time to fix it.

Thank you all at this point for your help! Looks like this age is getting cured :)
0
 
LVL 9

Author Comment

by:ornicar
ID: 18914682
Thank you
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question