<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>
Main Topics
Browse All TopicsHello.
I would like to make a layer centered.
See this page:
http://www.cybersouk.ch/lu
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/
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!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
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/lu
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.
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>
Credit to mplungjan
http://www.wpdfd.com/edito
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/
Business Accounts
Answer for Membership
by: rucky544Posted on 2007-04-07 at 05:57:41ID: 18869315
would be easier to make it relatively positioned inside the table cell you want it to sit in.