Blogger Information
Blog 22
fans 1
comment 0
visits 17754
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
第十期FLEX项目六大属性+组件开发思路分析总结(2019-12-25)
齐齐
Original
1039 people have browsed it

flex项目6大属性

组件开发思路总结

  • 组件这个专业词,非常的陌生,概念也非常模糊。组件是可以组合的零件,简单的理解其功能,能够简单快速搭建出页面,@import语法来实现样式的组装,硬性要求每个组件都需要有独特的类名:class。

  • html文档的class要和html文件名和css文件中的命名一样相对应,方便以后查找。css文件命名推荐下划线,其他文件或者类名关键词之间用连接线。

  • 分析组件结构,有条理性的快速完成组件。写好的初始化样式通过关键字@import导入样式表中。写css样式的时候,边写边想效果。弹性盒子中用float无效,直接被干掉了

公共头部导航flex案例实例

html代码

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>全站头部导航</title>
  6. <link rel="stylesheet" href="../../static/font/iconfont.css">
  7. <link rel="stylesheet" href="public_head.css">
  8. </head>
  9. <body>
  10. <div class="public-head">
  11. <a href="">网站首页</a>
  12. <a href="">专题</a>
  13. <a href="">网站导航</a>
  14. <a href="">二手商品</a>
  15. <a href="">讨论区</a>
  16. <span>
  17. <a href=""><i class="iconfont icon-huiyuan2"></i> 登陆</a>
  18. <a href="">免费注册</a>
  19. </span>
  20. </div>
  21. </body>
  22. </html>

公共头部css文件:public_head.css

  1. /*导入元素的公共初始化样式表*/
  2. @import url(../public_reset.css);
  3. .public-head{
  4. height: 44px;
  5. background-color:#000;
  6. padding: 0 20px;
  7. display: flex;
  8. flex-flow:row nowrap;
  9. }
  10. .public-head a{
  11. line-height: 44px;
  12. color:#ccc;
  13. padding: 0 10px;
  14. }
  15. .public-head>a:hover{background-color: #fff;color:#000;}
  16. .public-head span{margin-left: auto}
  17. .public-head span i{
  18. font-size: 16px;
  19. color:#ccc;
  20. padding-right: 10px;
  21. }

公共初始化样式表:public_reset.css

  1. *{padding:0;margin: 0;
  2. /*outline:1px dashed red;*/
  3. }
  4. body{font-size: 13px;background-color: #efefef;color:#555;}
  5. a{font-size: #404040;text-decoration:none;}
  6. li{list-style: none;}

代码运行效果图

Correcting teacher:天蓬老师天蓬老师

Correction status:qualified

Teacher's comments:不仅把float干掉, 顺便连clear也干掉了
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