?
Solved

Make a layer centered

Posted on 2007-04-07
8
Medium Priority
?
378 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 400 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
Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

 
LVL 5

Assisted Solution

by:NickVd
NickVd earned 400 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 200 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

Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

Question has a verified solution.

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

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

765 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