html 居中的內容顯示框
阿新 • • 發佈:2018-11-02
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="Generator" content="EditPlus®"> <meta name="Author" content=""> <meta name="Keywords" content=""> <meta name="Description" content=""> <title>Document</title> <style> html,body { height: 100%; overflow: hidden; } body,div,h2{ margin: 0; } center{ padding-top: 10px; } button{ cursor: pointer; } #outer{ position: fixed; top: 0; left: 0; width: 5%; height: 100%; background: #000; opacity: 0.5; filter:alpha(opacity=50); display: block; } #windows{ position: absolute; top: 50%; left: 50%; width: 50%; height: 45%; background: #fff; border: 4px solid #F90; overflow: hidden; transform: translate3d(-50%, -50%, 0); display: block; } h2{ text-align: right; background: #FC0; border-bottom: 3px solid #F90; } h2 span{ color: #F90; cursor: pointer; background: #FFF; border: 1px solid #F90; padding: 0 2px; } p{ text-align: justify; text-indent: 2em; } </style> </head> <body> <div id="windows"> <h2>title<span id="close">*</span></h2> <p>測試平臺測試平臺測試平臺測試平臺測試平臺測試測試平臺</p> </div> </body> </html>