css - Positioning popup window in middle of the screen without JavaScript -


i have following html , css, position popup window in middle of screen in browser window size. possible without javascript?

css:

.floating-window {     z-index: 9999;     position: absolute;     width: 200px; height: 200px;       cursor: default;     -moz-box-shadow: 1px 1px 1px #888;     -webkit-box-shadow: 1px 1px 1px #888;     box-shadow: 1px 1px 1px #888; } 

html:

<div class='floating-window box'></div> 

with percentages, can set box such half of on left side.

width: 30%; left: 45%; /* 50% (center) - 15% (half of 30) */ 

you use px you'll limited absolute container width. have searched around? know there articles explaining method more extensively have.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -