[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Make a layer centered

Posted on 2007-04-07
8
Medium Priority
?
394 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
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

649 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