Jump to content

centre Div


nezbo

Recommended Posts

Hi all

 

I have been looking at centerlizing a div,

 

i have got this in the CSS so for, i am not to sure how to make it stick to the centre of the page when i scrole, at the moment it sticks to the top left corner...

 

please ignore the visibility:hidden; i is made visible with javascript...

 

I am not to use i understand the expression( ( 0 + ( ignoreMe = document.documentElement.scroll....... bits, so i dont know how to make them centered.

 

div#theDiscText
{
position:absolute;
visibility:hidden;
background-color:#FFFFFF;
filter:alpha(opacity=100);-moz-opacity:1.;opacity:1.0;
width:50%;
z-index:200;
border-style:solid;
border-color:#000000;
border-width:1px;
left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
  	top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
}

Link to comment
https://forums.phpfreaks.com/topic/114812-centre-div/
Share on other sites

Sorry should have posted more of the code...

 

the fixme does the background and theDiscText does the text box...

 

div#theDiscText
{
position:absolute;
visibility:hidden;
background-color:#FFFFFF;
width:50%;
z-index:200;
border-style:solid;
border-color:#000000;
border-width:2px;
left: 25%;  	
top: expression(( 200 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
}
body > div#theDiscText
{ 
position: fixed;
margin: auto;
top:35%;
left:25%;	
}

div#fixme 
{
     /* IE5.5+/Win - this is more specific than the IE 5.0 version */
    position:absolute;
filter:alpha(opacity=70);-moz-opacity:.70;opacity:.70;
height:100%;
width:100%;
visibility: hidden;
z-index:100;
left: expression( ( 0 + ( ignoreMe2 = document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft ) ) + 'px' );
  	top: expression( ( 0 + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop ) ) + 'px' );
vertical-align:middle;
text-align:center;
background-color:#000000; 
border-color:#ffffff;
border-width:0px; 
border-style:solid;
padding-left:7px; 
padding-right:7px;
}
body > div#fixme
{ 
position: fixed;
margin: auto;
top:0px;
left:0px;	
}

Link to comment
https://forums.phpfreaks.com/topic/114812-centre-div/#findComment-591369
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.