Center a popup window on screen?

前端 未结 18 1031
一整个雨季
一整个雨季 2020-11-22 16:51

How can we center a popup window opened via javascript window.open function on the center of screen variable to the currently selected screen resolution ?

18条回答
  •  温柔的废话
    2020-11-22 17:27

    .center{
        left: 50%;
        max-width: 350px;
        padding: 15px;
        text-align:center;
        position: relative;
        transform: translateX(-50%);
        -moz-transform: translateX(-50%);
        -webkit-transform: translateX(-50%);
        -ms-transform: translateX(-50%);
        -o-transform: translateX(-50%);   
    }

提交回复
热议问题