M.O.S. Studios Posted February 21, 2009 Share Posted February 21, 2009 i would like to get the div.content to always show in the middle of the screen, any one know the css for that? here is my code: <html> <head> <style type="text/css"> div.wrapper { width:99%; } div.left_column { float:left; text-align:right; vertical-align:middle; } div.content { width:800; height:700; float:left; text-align:right; background-color: #ff9a9a; background-IMAGE: url(images/content_bg1.gif); background-repeat: no-repeat; background-position: top left; border-width: .2em; border-style: solid; border-color: #504e4f; } div.right_column { float:right; text-align:center; vertical-align:middle; } hr { clear:both; display:block; visibility:hidden;} </style> </head> <body bgcolor='#000000' text='#ffffff'> <center><img src='logo.gif'></center> <div class="wrapper"> <div class="left_column"> left </div> <div class="content"> </div> <div class="right_column"> </div> </div> thanks in advance Link to comment https://forums.phpfreaks.com/topic/146297-solved-centering-a-in-the-absolute-middle-ofthe-screen/ Share on other sites More sharing options...
M.O.S. Studios Posted February 22, 2009 Author Share Posted February 22, 2009 found the answer change the css to: <style type="text/css"> div.wrapper { width:100%; } div.left_column { float:left; text-align:right; vertical-align:middle; } div.content { Position:absolute; left: 25%; width:800; height:700; float:left; text-align:right; background-color: #ff9a9a; background-IMAGE: url(images/content_bg1.gif); background-repeat: no-repeat; background-position: top left; border-width: .2em; border-style: solid; border-color: #504e4f; } div.right_column { float:right; text-align:center; vertical-align:middle; } hr { clear:both; display:block; visibility:hidden;} </style> Link to comment https://forums.phpfreaks.com/topic/146297-solved-centering-a-in-the-absolute-middle-ofthe-screen/#findComment-768073 Share on other sites More sharing options...
dropfaith Posted February 22, 2009 Share Posted February 22, 2009 or just use div.content {margin:0 auto;width:80%; centers a div and will leave a 10 percent of the screen margin on left and right side on all scree res Link to comment https://forums.phpfreaks.com/topic/146297-solved-centering-a-in-the-absolute-middle-ofthe-screen/#findComment-768114 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.