Blogger Information
Blog 34
fans 0
comment 0
visits 24469
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
css基础-定位,模态框
CY明月归
Original
449 people have browsed it

作业内容:

  1. 定位
  2. 模态框

定位:

  1. /* 定位:
  2. 默认静态定位, static
  3. */
  4. h1,h2{
  5. border: 1px solid ;
  6. }
  7. /*相对定位: 依然在文档流,受文档流控制,只是相对于!!自身原本的位置!!发生变化, relative*/
  8. /* h2{
  9. position: relative;
  10. top: 30px;
  11. }
  12. /*绝对定位: 已经在不受文档流控制,相对于定位父级发生位置偏移, absolute*/
  13. h2{
  14. position: absolute;
  15. top: 30px;
  16. }
  17. /*固定定位: 不受文档流控制,总是相对于body, fixed */
  18. h2{
  19. position: fixed;
  20. top: 30px;
  21. left: 200px;
  22. }

模态框:(只贴importent代码)

  1. header{/*弹性布局(display:flex;)否则登录按钮会出现在第二行*/
  2. display: flex;
  3. ...
  4. }
  5. button .login{/*em单位复习*/
  6. margin-left: auto;
  7. height: 2em;
  8. ...
  9. }
  10. .modal{/*隐藏,通过js事件控制*/
  11. display: none;
  12. }
  13. .reg{/*固定布局*/
  14. position: fixed;
  15. ...
  16. }
  17. .mo{/*alpha 透明度(a)取值 0~1 之间, 代表透明度*/
  18. background-color: rgba(0, 0, 0,0.5);
  19. }

添加关闭按钮与动画-优化版本

  1. <span class="close">x</span>
  2. .close:hover,
  3. .close:focus {
  4. color: #000;
  5. text-decoration: none;
  6. cursor: pointer;
  7. }

Correcting teacher:PHPzPHPz

Correction status:qualified

Teacher's comments:
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post