博客列表 >PHP大牛成长之路:Flex布局仿PHP中文网

PHP大牛成长之路:Flex布局仿PHP中文网

周Sir-BLOG
周Sir-BLOG原创
2020年06月29日 19:21:41636浏览

Flex布局仿PHP中文网

效果图如下:

HTML&DOM结构:

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <link rel="stylesheet" href="./static/css/common.css" />
  7. <link rel="stylesheet" href="./static/css/style.css" />
  8. <title>Document</title>
  9. </head>
  10. <body>
  11. <!-- 头部 -->
  12. <div class="header">
  13. <div class="nav flexDis flexAlignC">
  14. <div class="logo"></div>
  15. <ul>
  16. <li><a href="">首页</a></li>
  17. <li><a href="">视频教程</a></li>
  18. <li><a href="">入门教程</a></li>
  19. <li><a href="">社区问答</a></li>
  20. <li><a href="">技术文章</a></li>
  21. <li><a href="">资源下载</a></li>
  22. <li><a href="">编程词典</a></li>
  23. <li><a href="">工具下载</a></li>
  24. <li><a href="">PHP培训</a></li>
  25. </ul>
  26. <p><a href="">注册</a><a href="">登录</a></p>
  27. </div>
  28. </div>
  29. <!-- 主体 -->
  30. <div class="top container flexDis">
  31. <div class="menuList">
  32. <ul>
  33. <li>
  34. <a href="">PHP开发<span>></span></a>
  35. </li>
  36. <li>
  37. <a href="">前端开发<span>></span></a>
  38. </li>
  39. <li>
  40. <a href="">服务端开发<span>></span></a>
  41. </li>
  42. <li>
  43. <a href="">移动开发<span>></span></a>
  44. </li>
  45. <li>
  46. <a href="">数据库<span>></span></a>
  47. </li>
  48. <li>
  49. <a href="">服务器运维&下载<span>></span></a>
  50. </li>
  51. <li>
  52. <a href="">在线工具箱<span>></span></a>
  53. </li>
  54. <li>
  55. <a href="">常用类库<span>></span></a>
  56. </li>
  57. </ul>
  58. </div>
  59. <div class="viewAd">
  60. <div class="search">
  61. <a href="">PHP头条</a><span class="span1"></span>
  62. <a href="">孤独九贱</a>
  63. <a href="">学习路线</a><span class="span2"></span>
  64. <a href="">在线工具</a>
  65. <a href="">趣味课堂</a><span class="span3"></span>
  66. <a href="">社区问答</a>
  67. <a href="">课程直播</a>
  68. <span class="searchInput">
  69. <input type="text" placeholder="输入关键字搜索" /><a href=""></a>
  70. </span>
  71. </div>
  72. <div class="viewImg">
  73. <img src="./static/img/b1.png" alt="" />
  74. </div>
  75. <div class="adImg flexDis flexAlignC flexContentA">
  76. <p>
  77. <a href=""><img src="./static/img/1.jpg" alt="" /></a>
  78. </p>
  79. <p>
  80. <a href=""><img src="./static/img/2.png" alt="" /></a>
  81. </p>
  82. <p>
  83. <a href=""><img src="./static/img/3.jpg" alt="" /></a>
  84. </p>
  85. <p>
  86. <a href=""><img src="./static/img/4.jpg" alt="" /></a>
  87. </p>
  88. </div>
  89. </div>
  90. </div>
  91. <!-- AD -->
  92. <div class="ad1 container">
  93. <a href=""> <img src="./static/img/index_ad222.jpg" alt="" /></a>
  94. </div>
  95. <!-- 内容1 -->
  96. <div class="content1 container flexDis">
  97. <!-- 内容-左-->
  98. <div class="left">
  99. <h4>&nbsp; 头条</h4>
  100. <p><a href="">php中文网原创视频:《天龙八部》公益ph...</a></p>
  101. <p><a href="">php中文网《玉女心经》公益PHP培训系列...</a></p>
  102. <p><a href="">php的版本发展历史(1995-2020)</a></p>
  103. <p><a href="">您知道吗?最好的语言:PHP 25 岁了!</a></p>
  104. <p><a href=""></php>史上最污技术解读,我竟然秒懂了</a></p>
  105. <p><a href="">2020年最新5个简洁优秀的个人博客模板免...</a></p>
  106. <p><a href="">5款优秀的vue后台管理系统模板推荐(免...</a></p>
  107. <p><a href="">6个大气的bootstrap后台管理系统模板推荐...</a></p>
  108. <p><a href="">5款简洁的layui后台管理模板推荐(免费下...</a></p>
  109. <p><a href="">5款个性的网页回到顶部特效代码</a></p>
  110. <p><a href="">小皮面板 v0.53 版本今日发布!</a></p>
  111. <p><a href="">phpstudy v8.1.0.4 版本今日发布!</a></p>
  112. </div>
  113. <!-- 内容-中-->
  114. <div class="main flexGrowAuto">
  115. <h4>&nbsp; 最新课程</h4>
  116. <ul class="flexDis flexWrap ">
  117. <li>
  118. <a href="">
  119. <div><img src="./static/img/11.jpg" alt=""></div>
  120. <div><span>中级</span>PHP代码整洁之道</div>
  121. </a>
  122. </li>
  123. <li>
  124. <a href="">
  125. <div><img src="./static/img/22.png" alt=""></div>
  126. <div><span>初级</span>前端课程(五郞八卦棍系列)第一棍:HTML5</div>
  127. </a>
  128. </li>
  129. <li>
  130. <a href="">
  131. <div><img src="./static/img/33.png" alt=""></div>
  132. <div><span>初级</span>小皮面板使用视频教程</div>
  133. </a>
  134. </li>
  135. <li>
  136. <a href="">
  137. <div><img src="./static/img/44.png" alt=""></div>
  138. <div><span>初级</span>从零进入C语言</div>
  139. </a>
  140. </li>
  141. <li>
  142. <a href="">
  143. <div><img src="./static/img/55.png" alt=""></div>
  144. <div><span>中级</span>C语言进阶篇</div>
  145. </a>
  146. </li>
  147. <li>
  148. <a href="">
  149. <div><img src="./static/img/66.png" alt=""></div>
  150. <div><span>中级</span>PHP快速操控Excel之PhpSpreadsheet</div>
  151. </a>
  152. </li>
  153. </ul>
  154. </div>
  155. <!-- 内容-右-->
  156. <div class="right">
  157. <h4>&nbsp; 常用手册</h4><h4><a href="">更多</a></h4>
  158. <ul >
  159. <li class="flexDis">
  160. <div class="rightImg">
  161. <img src="./static/img/php.png" alt="">
  162. </div>
  163. <div class="rightFont flexDis flexWrap flexAlignC">
  164. <a href="">PHP手册</a>
  165. <a href="">Linux手册</a>
  166. <a href="">ThinkPHP6.0</a>
  167. <a href="">CI手册大全</a>
  168. </div>
  169. </li>
  170. <li class="flexDis">
  171. <div class="rightImg">
  172. <img src="./static/img/js.png" alt="">
  173. </div>
  174. <div class="rightFont flexDis flexWrap flexAlignC">
  175. <a href="">JavaScript中文参考手册</a>
  176. <a href="">jQuery手册大全</a>
  177. </div>
  178. </li>
  179. <li class="flexDis">
  180. <div class="rightImg">
  181. <img src="./static/img/mysql.png" alt="">
  182. </div>
  183. <div class="rightFont flexDis flexWrap flexAlignC">
  184. <a href="">MySQL参考手册大全</a>
  185. <a href="">laravel5.8速查表</a>
  186. </div>
  187. </li>
  188. <li class="flexDis">
  189. <div class="rightImg">
  190. <img src="./static/img/python.png" alt="">
  191. </div>
  192. <div class="rightFont flexDis flexWrap flexAlignC">
  193. <a href="">Python参考手册大全</a>
  194. <a href="">Node.js中文学习手册</a>
  195. </div>
  196. </li>
  197. <li class="flexDis">
  198. <div class="rightImg">
  199. <img src="./static/img/html.png" alt="">
  200. </div>
  201. <div class="rightFont flexDis flexWrap flexAlignC">
  202. <a href="">html手册</a>
  203. <a href="">CSS手册</a>
  204. <a href="">AngularJS</a>
  205. <a href="">Ajax手册</a>
  206. </div>
  207. </li>
  208. <li class="flexDis">
  209. <div class="rightImg">
  210. <img src="./static/img/asp.jpg" alt="">
  211. </div>
  212. <div class="rightFont flexDis flexWrap flexAlignC">
  213. <a href="">ASP参考手册大全</a>
  214. <a href="">Bootstrap3参考手册</a>
  215. </div>
  216. </li>
  217. </ul>
  218. </div>
  219. </div>
  220. <div class="content2 container flexDis flexContentB">
  221. <div class="content_ad_down">
  222. <div class="content_ad">
  223. <img src="./static/img/ad01.jpg" alt="">
  224. <a href=""> phpStudy极速入门视频教程</a>
  225. <span></span>
  226. <span></span>
  227. <span></span>
  228. </div>
  229. <div class="content_down">
  230. <div class="down_title"><span><a href="">更多>></a> </span>php开发辅助工具下载</div>
  231. <div class="down_content">
  232. <ul>
  233. <li><span>8-17</span><a href="">小皮面板(phpStudy for Linux 服务器运维管理</a></li>
  234. <li><span>8-17</span><a href="">VSCode Windows 64位 下载</a></li>
  235. <li><span>8-17</span><a href="">Memcached Win64位系统 1.4.4版本</a></li>
  236. <li><span>8-17</span><a href="">Memcached Win32位系统 1.4.4版本</a></li>
  237. <li><span>8-17</span><a href="">Memcached Win64位系统 1.4.5版本</a></li>
  238. <li><span>8-17</span><a href="">Memcached Win32位系统 1.4.5版本</a></li>
  239. <li><span>8-17</span><a href="">phpstudy安全自检修复程序</a></li>
  240. <li><span>8-17</span><a href="">phpStudy V8.1(Win64位)</a></li>
  241. <li><span>8-17</span><a href="">phpStudy V8.1(Win32位)</a></li>
  242. </ul>
  243. </div>
  244. </div>
  245. </div>
  246. <div class="content_arc">
  247. <div class="arc_title">
  248. <span>技术文章</span>
  249. <span>网站源码</span>
  250. <span>原生手册</span>
  251. <span>推荐博文</span>
  252. </div>
  253. <div class="arc_content">
  254. <ul>
  255. <li><span>php教程</span><span>|</span><a href="">什么是逆波兰式?</a><span>2020-06-24 </span></li>
  256. <li><span>PHP7</span><span>|</span><a href="">学习PHP7的革新与性能优化</a><span>2020-06-24 </span></li>
  257. <li><span>mysql教程</span><span>|</span><a href="">什么是逆波兰式?</a><span>2020-06-24 </span></li>
  258. <li><span>Laravel</span><span>|</span><a href="">Laravel 如何包含自己的助手函数?</a><span>2020-06-24 </span></li>
  259. <li><span>ThinkPHP</span><span>|</span><a href="">ThinkPHP 6.0 多语言优化扩展包的安装与使</a><span>2020-06-23 </span></li>
  260. <li><span>css教程</span><span>|</span><a href="">css3新增伪类有哪些</a><span>2020-06-24 </span></li>
  261. <li><span>js教程</span><span>|</span><a href="">ES6 Generator 基本使用</a><span>2020-06-24 </span></li>
  262. <li><span>Redis</span><span>|</span><a href="">Redis集群中的节点分为哪两个</a><span>2020-06-24 </span></li>
  263. <li><span>小程序开发</span><span>|</span><a href="">什么是骨架屏(Skeleton Screen)?</a><span>2020-06-24 </span></li>
  264. <li><span>Python教</span><span>|</span><a href="">Python 如何自定义模块?</a><span>2020-06-24 </span></li>
  265. <li><span>Python教</span><span>|</span><a href="">Python 的 help 函数使用</a><span>2020-06-24 </span></li>
  266. <li><span>Java基础</span><span>|</span><a href="">Java Reactor 反应器模式</a><span>2020-06-24 </span></li>
  267. <li><span>C#.Net教</span><span>|</span><a href="">C++语言标识符的命名规则是什么?</a><span>2020-06-24 </span></li>
  268. <li><span>Golang</span><span>|</span><a href="">Go Wails 框架构建桌面应用示例</a><span>2020-06-24 </span></li>
  269. <li><span>Docker</span><span>|</span><a href="">docker是什么?有什么作用?</a><span>2020-06-24 </span></li>
  270. <li><span>PHP问题</span><span>|</span><a href="">PHP中 fsockopen 函数怎么用?</a><span>2020-06-24 </span></li>
  271. <li><span>Apache</span><span>|</span><a href="">如何在centos下安装apache</a><span>2020-06-24 </span></li>
  272. <li><span>Nginx</span><span>|</span><a href="">nginx实现负载均衡有哪几个模式</a><span>2020-06-24 </span></li>
  273. </ul>
  274. </div>
  275. </div>
  276. <div class="content_qa">
  277. <div class="qa_title"><span>社区问答</span></div>
  278. <div class="qa_content">
  279. <ul>
  280. <li><a href="">总是显示密码错误,登录不了</a></li>
  281. <li><a href="">朱老师用的什么屏幕截取软件?</a></li>
  282. <li><a href="">请问jQuery按手机返回键后,不回退页面...</a></li>
  283. <li><a href="">PHP7 编译安装 扩展相关问题</a></li>
  284. <li><a href="">90%22=2 这个是怎么个模法?</a></li>
  285. <li><a href="">页面中iframe内元素点击</a></li>
  286. <li><a href="">朱老师, 这个地方按你的分类列表出不来...</a></li>
  287. <li><a href="">朱老师,第6章后是不是还有内容啊</a></li>
  288. <li><a href="">发帖后,再进行修改,帖子时间是第一次...</a></li>
  289. <li><a href="">think目录下没有Db目录</a></li>
  290. <li><a href="">只能访问index,不能访问hello</a></li>
  291. <li><a href="">编辑页面出不来</a></li>
  292. <li><a href="">关键词打开网站很慢怎么解决</a></li>
  293. <li><a href="">登录不能跳转到后台</a></li>
  294. <li><a href="">访问中心服务器错误</a></li>
  295. </ul>
  296. </div>
  297. </div>
  298. </div>
  299. <!-- ad:phpStudy -->
  300. <div class="ad2 container"><a href=""><img src="./static/img/phpstudy.jpg" alt=""></a></div>
  301. <!-- 词典搜索 -->
  302. <div class="search-related container flexDis">
  303. <div class="related_type">
  304. <div class="type_title">词典分类</div>
  305. <div class="type_content">
  306. <ul>
  307. <li><a href=""><i></i> HTML/CSS<span>HTML/CSS</span></a></li>
  308. <li><a href=""><i></i>JavaScript<span>JavaScript</span></a></li>
  309. <li><a href=""><i></i>服务端<span>服务端</span></a></li>
  310. <li><a href=""><i></i>数据库<span>数据库</span></a></li>
  311. <li><a href=""><i></i>移动端<span>移动端</span></a></li>
  312. <li><a href=""><i></i>XML<span>XML</span></a></li>
  313. <li><a href=""><i></i>ASP.NET<span>ASP.NET</span></a></li>
  314. <li><a href=""><i></i>Web Services<span>Web Services</span></a></li>
  315. <li><a href=""><i></i>开发工具<span>开发工具</span></a></li>
  316. <li><a href=""><i></i>网站建设<span>网站建设</span></a></li>
  317. </ul>
  318. </div>
  319. </div>
  320. <div class="related_search">
  321. <div class="search_title flexDis"><a href="">词典查询</a><a href="">全部词典</a><a href="">最近更新</a></div>
  322. <div class="search_content flexDis flexDir-y">
  323. <div class="sc_title">编程词典</div>
  324. <div class="sc_title2">服务码农的在线技术手册</div>
  325. <div class="search_div">
  326. <span></span>
  327. <span><input type="text" placeholder="请输入搜索内容"></span>
  328. <span><button>搜索</button></span>
  329. </div>
  330. <div class="hot_key">热门搜索:<span>PHP</span><span>MySQL</span><span>jquery</span><span>HTML</span><span>CSS</span></div>
  331. <div class="ls_key">历史搜索:</div>
  332. </div>
  333. </div>
  334. </div>
  335. <!-- 内容3 -->
  336. <div class="content3 container ">
  337. <div class="content3_title">php入门精品课程</div>
  338. <div class="content3_content flexDis">
  339. <div class="content_left">
  340. <div class="ct3_left_ad"><img src="./static/img/index_learn_first.jpg" alt=""></div>
  341. <ul>
  342. <li>
  343. <img src="./static/img/thinkphp.jpg" alt="">
  344. <a href="">ThinkPHP6.0极速入门(视频教程)</a>
  345. <span>4W+次播放</span>
  346. </li>
  347. </ul>
  348. </div>
  349. <div class="content_right ">
  350. <ul class="flexDis flexWrap flexContentB flexAlignT">
  351. <li>
  352. <img src="./static/img/thinkphp.jpg" alt="">
  353. <a href="">ThinkPHP6.0极速入门(视频教程)</a>
  354. <span>4W+次播放</span>
  355. </li>
  356. <li>
  357. <img src="./static/img/thinkphp.jpg" alt="">
  358. <a href="">ThinkPHP6.0极速入门(视频教程)</a>
  359. <span>4W+次播放</span>
  360. </li>
  361. <li>
  362. <img src="./static/img/thinkphp.jpg" alt="">
  363. <a href="">ThinkPHP6.0极速入门(视频教程)</a>
  364. <span>4W+次播放</span>
  365. </li>
  366. <li>
  367. <img src="./static/img/thinkphp.jpg" alt="">
  368. <a href="">ThinkPHP6.0极速入门(视频教程)</a>
  369. <span>4W+次播放</span>
  370. </li>
  371. <li>
  372. <img src="./static/img/thinkphp.jpg" alt="">
  373. <a href="">ThinkPHP6.0极速入门(视频教程)</a>
  374. <span>4W+次播放</span>
  375. </li>
  376. <li>
  377. <img src="./static/img/thinkphp.jpg" alt="">
  378. <a href="">ThinkPHP6.0极速入门(视频教程)</a>
  379. <span>4W+次播放</span>
  380. </li>
  381. <li>
  382. <img src="./static/img/thinkphp.jpg" alt="">
  383. <a href="">ThinkPHP6.0极速入门(视频教程)</a>
  384. <span>4W+次播放</span>
  385. </li>
  386. <li>
  387. <img src="./static/img/thinkphp.jpg" alt="">
  388. <a href="">ThinkPHP6.0极速入门(视频教程)</a>
  389. <span>4W+次播放</span>
  390. </li>
  391. <li>
  392. <img src="./static/img/thinkphp.jpg" alt="">
  393. <a href="">ThinkPHP6.0极速入门(视频教程)</a>
  394. <span>4W+次播放</span>
  395. </li>
  396. <li>
  397. <img src="./static/img/thinkphp.jpg" alt="">
  398. <a href="">ThinkPHP6.0极速入门(视频教程)</a>
  399. <span>4W+次播放</span>
  400. </li>
  401. <li>
  402. <img src="./static/img/thinkphp.jpg" alt="">
  403. <a href="">ThinkPHP6.0极速入门(视频教程)</a>
  404. <span>4W+次播放</span>
  405. </li>
  406. <li>
  407. <img src="./static/img/thinkphp.jpg" alt="">
  408. <a href="">ThinkPHP6.0极速入门(视频教程)</a>
  409. <span>4W+次播放</span>
  410. </li>
  411. </ul>
  412. </div>
  413. </div>
  414. </div>
  415. <!-- 底部 -->
  416. <div class="footer">
  417. <div class="footer_left container">
  418. <p class="footer_link">
  419. <a href="">网站首页</a>
  420. <a href="">PHP视频</a>
  421. <a href="">PHP代码</a>
  422. <a href="">PHP手册</a>
  423. <a href="">词条手记</a>
  424. <a href="">编程词典</a>
  425. </p>
  426. <p class="footer_company">
  427. <span>php中文网:公益在线php培训,帮助PHP学习者快速成长!</span>
  428. <img src="./static/img/label_lg_90030.png" alt=""> 合肥彼岸互联信息技术有限公司
  429. </p>
  430. <p class="copyright">
  431. Copyright 2014-2020 php.cn All Rights Reserved | 皖B2-20150071-9
  432. <img src="./static/img/foot_line.gif" alt="">
  433. 皖公网安备 34010402701654号
  434. <img src="./static/img/foot_line.gif" alt="">
  435. <a href="">关于我们</a>
  436. <a href="">免责申明</a>
  437. <a href="">赞助与捐赠</a>
  438. <a href="">广告合作</a>
  439. </p>
  440. <p class="add_tel">座机号码:0551-64933227 安徽省合肥市政务新区置地广场D座2101</p>
  441. <div class="code">
  442. <img src="./static/img/code1.png" alt="">
  443. <img src="./static/img/code2.jpg" alt="">
  444. </div>
  445. </div>
  446. </div>
  447. </body>
  448. </html>

CSS样式:

  1. .header {
  2. max-height: 60px;
  3. font-size: 1em;
  4. }
  5. .header .logo {
  6. display: block;
  7. height: 60px;
  8. width: 140px;
  9. background: url("../img/logo.png") no-repeat center;
  10. background-size: 100%;
  11. margin-left: 2em;
  12. }
  13. .header .nav {
  14. background: #000;
  15. }
  16. .header .nav ul {
  17. padding: 0 1.6em;
  18. margin: 0 3em;
  19. }
  20. .header .nav ul li {
  21. display: inline-block;
  22. }
  23. .header .nav ul li a {
  24. display: inline-block;
  25. text-align: center;
  26. width: 85px;
  27. height: 60px;
  28. line-height: 60px; /* 文本垂直居中 */
  29. color: rgba(255, 255, 255, 0.7);
  30. }
  31. .header .nav ul li:first-of-type {
  32. background-color: #363c41;
  33. }
  34. .header .nav ul li a:hover {
  35. color: rgba(255, 255, 255, 1);
  36. border-bottom: 5px solid #5fb878;
  37. }
  38. .header .nav p {
  39. margin-left: auto;
  40. }
  41. .header .nav p a {
  42. display: inline-block;
  43. width: 60px;
  44. height: 60px;
  45. text-align: center;
  46. line-height: 60px;
  47. color: rgba(255, 255, 255, 0.7);
  48. }
  49. .header .nav p a:hover {
  50. background: #363c41;
  51. }
  52. .top {
  53. height: 510px;
  54. /* border: 5px solid red; */
  55. /* padding: 1em 0; */
  56. margin-top: 20px;
  57. }
  58. .top .menuList {
  59. width: 210px;
  60. /* border: 5px solid blue; */
  61. background: #2b333b;
  62. border-top-left-radius: 0.8em;
  63. border-bottom-left-radius: 0.8em;
  64. }
  65. .top .menuList li {
  66. position: relative;
  67. }
  68. .top .menuList a {
  69. display: inline-block;
  70. width: 100%;
  71. color: rgba(255, 255, 255, 0.8);
  72. margin-top: 0.8em;
  73. padding: 0.85em 1.5em;
  74. font-size: 1.1em;
  75. }
  76. .top .menuList a:hover {
  77. background: rgba(255, 255, 255, 0.2);
  78. }
  79. .top .menuList span {
  80. color: rgba(255, 255, 255, 0.8);
  81. position: absolute;
  82. top: 45%;
  83. right: 10%;
  84. }
  85. /* 搜索 */
  86. .top .search {
  87. background: #fff;
  88. height: 60px;
  89. /* width: 990px; */
  90. border-top-right-radius: 0.8em;
  91. box-shadow: 0 0.2em 0.4em rgba(0, 0, 0, 0.2);
  92. line-height: 60px;
  93. position: relative;
  94. }
  95. .top .search a {
  96. color: #333;
  97. margin: 0 18px;
  98. }
  99. .top .search .span1 {
  100. color: #fff;
  101. background: #ff5722;
  102. border-radius: 0.2em;
  103. position: absolute;
  104. top: 32%;
  105. left: 7.5%;
  106. width: 20px;
  107. height: 20px;
  108. text-align: center;
  109. line-height: 20px;
  110. }
  111. .top .search .span2 {
  112. color: #fff;
  113. background: #2f4056;
  114. border-radius: 0.2em;
  115. position: absolute;
  116. top: 32%;
  117. left: 26.8%;
  118. width: 20px;
  119. height: 20px;
  120. text-align: center;
  121. line-height: 20px;
  122. }
  123. .top .search .span3 {
  124. color: #fff;
  125. background: #ffb800;
  126. border-radius: 0.2em;
  127. position: absolute;
  128. top: 32%;
  129. left: 46%;
  130. width: 20px;
  131. height: 20px;
  132. text-align: center;
  133. line-height: 20px;
  134. }
  135. .top .search .searchInput {
  136. position: absolute;
  137. top: 20%;
  138. right: 20px;
  139. width: 270px;
  140. height: 40px;
  141. background: #f1f0f0;
  142. line-height: 40px;
  143. border-radius: 0.2em;
  144. }
  145. .top .searchInput:hover {
  146. border-bottom: 1px solid silver;
  147. }
  148. .top .searchInput input {
  149. width: 210px;
  150. height: 40px;
  151. outline: none;
  152. /* vertical-align: middle; */
  153. background: none;
  154. border: none;
  155. margin-left: 10px;
  156. }
  157. .top .viewImg {
  158. box-shadow: 0 4px 8px 0 rgba(7, 17, 27, 0.05);
  159. }
  160. .top .viewAd .adImg {
  161. height: 110px;
  162. background: rgba(255, 255, 255, 1);
  163. border-bottom-right-radius: 0.8em;
  164. box-shadow: 0 4px 8px 0 rgba(7, 17, 27, 0.05);
  165. margin-top: -2px;
  166. }
  167. .top .viewAd .adImg img {
  168. border-radius: 0.8em;
  169. }
  170. .ad1 img {
  171. margin: 20px 0;
  172. border-radius: 0.8em;
  173. }
  174. .ad2 img {
  175. margin-bottom: 10px;
  176. border-radius: 0.8em;
  177. }
  178. /* 内容1 */
  179. .content1 {
  180. height: 415px;
  181. }
  182. .content1 h4 {
  183. color: #343535;
  184. border-bottom: 1px dotted #e9e9e9;
  185. padding: 5px;
  186. /* height: 30px; */
  187. }
  188. .content1 .left {
  189. background: rgba(255, 255, 255, 1);
  190. box-shadow: 0 4px 8px 0 rgba(7, 17, 27, 0.05);
  191. border-radius: 0.8em;
  192. padding: 10px;
  193. width: 300px;
  194. }
  195. /* .content1 .left h4{
  196. color: #343535;
  197. border-bottom: 1px dotted #e9e9e9;
  198. padding: 5px;
  199. } */
  200. .content1 .left p {
  201. margin: 10px 0;
  202. }
  203. .content1 .left p a {
  204. margin: 115px 0;
  205. color: #333;
  206. }
  207. .content1 .left p a:hover {
  208. color: #777;
  209. }
  210. .content1 .right {
  211. background: rgba(255, 255, 255, 1);
  212. box-shadow: 0 4px 8px 0 rgba(7, 17, 27, 0.05);
  213. padding: 10px;
  214. border-radius: 0.8em;
  215. width: 260px;
  216. position: relative;
  217. }
  218. .content1 .right h4:last-of-type {
  219. /* background: #000; */
  220. position: absolute;
  221. top: 10px;
  222. right: 10%;
  223. }
  224. .content1 .right .rightImg {
  225. height: 60px;
  226. /* border: 1px solid #000; */
  227. line-height: 60px;
  228. }
  229. .content1 .right .rightImg img {
  230. width: 40px;
  231. margin-left: 5px;
  232. vertical-align: middle;
  233. }
  234. .content1 .right .rightFont {
  235. margin: 8px 5px;
  236. width: 100%;
  237. }
  238. .content1 .right .rightFont a {
  239. margin: 2px;
  240. color: #333;
  241. }
  242. .content1 .right .rightFont a:hover {
  243. color: #777;
  244. }
  245. .content1 .main {
  246. background: rgba(255, 255, 255, 1);
  247. box-shadow: 0 4px 8px 0 rgba(7, 17, 27, 0.05);
  248. border-radius: 0.8em;
  249. margin: 0 10px;
  250. padding: 10px;
  251. /* position: relative; */
  252. max-width: 620px;
  253. }
  254. .content1 .main span {
  255. background: #93999f;
  256. padding: 2px;
  257. color: #fff;
  258. font-size: 0.8em;
  259. margin: 0 5px;
  260. }
  261. .content1 .main ul li {
  262. /* margin: 10px 10px; */
  263. margin: 20px auto;
  264. /* height: 200px; */
  265. /* background: #777; */
  266. }
  267. .content1 .main ul li div {
  268. background: rgba(255, 255, 255, 1);
  269. box-shadow: 0 4px 8px 0 rgba(7, 17, 27, 0.1);
  270. border-radius: 0.7em;
  271. padding: 5px;
  272. /* margin: 15px; */
  273. width: 180px;
  274. height: 70px;
  275. position: relative;
  276. top: 10px;
  277. left: 0;
  278. /* border: 5px solid red; */
  279. }
  280. .content1 .main ul li a {
  281. color: #333;
  282. }
  283. .content1 .main ul li a:hover {
  284. color: #777;
  285. }
  286. .content1 .main ul li div img {
  287. border-radius: 0.8em;
  288. width: 180px;
  289. position: relative;
  290. top: -10px;
  291. left: -5px;
  292. }
  293. /* content2 */
  294. .content2 .content_ad_down {
  295. width: 360px;
  296. /* border: 1px solid red; */
  297. margin: 20px 0;
  298. }
  299. .content2 .content_ad_down .content_ad {
  300. height: 187px;
  301. border-radius: 0.7em;
  302. background: rgba(255, 255, 255, 1);
  303. margin-bottom: 10px;
  304. padding: 1px;
  305. }
  306. .content2 .content_ad_down .content_ad img {
  307. width: 356px;
  308. height: 183px;
  309. border-radius: 0.7em;
  310. }
  311. .content2 .content_ad_down .content_ad a {
  312. display: block;
  313. position: relative;
  314. top: -33px;
  315. left: 0;
  316. background: rgb(0, 0, 0, 0.7);
  317. color: #fff;
  318. width: 300px;
  319. height: 30px;
  320. line-height: 30px;
  321. padding-left: 10px;
  322. }
  323. .content2 .content_ad_down .content_ad span {
  324. display: inline-block;
  325. position: relative;
  326. top: -53px;
  327. left: 305px;
  328. background: rgb(0, 0, 0, 0.7);
  329. color: #fff;
  330. margin: 0 1px;
  331. width: 8px;
  332. height: 10px;
  333. line-height: 30px;
  334. padding-left: 10px;
  335. }
  336. .content2 .content_ad_down .content_down {
  337. background: rgb(255, 255, 255, 1);
  338. border-radius: 0.7em;
  339. position: relative;
  340. /* border: 1px solid red; */
  341. }
  342. .content2 .content_ad_down .content_down .down_title {
  343. font-weight: bold;
  344. height: 33px;
  345. line-height: 33px;
  346. border-bottom: 2px solid rgb(255, 74, 0);
  347. padding-left: 10px;
  348. }
  349. .content2 .content_ad_down .content_down .down_title span {
  350. position: absolute;
  351. top: 0;
  352. right: 8px;
  353. }
  354. .content2 .content_ad_down .content_down .down_title span a {
  355. color: #333;
  356. font-weight: normal;
  357. }
  358. .content2 .content_ad_down .content_down .down_title span a:hover {
  359. color: #777;
  360. }
  361. .content2 .content_ad_down .content_down .down_content {
  362. /* margin-top: 10px;
  363. margin-left: 20px; */
  364. min-height: 260px;
  365. }
  366. .content2 .content_ad_down .content_down .down_content ul li {
  367. list-style: outside;
  368. margin: 10px 20px;
  369. color: #ccc;
  370. }
  371. .content2 .content_ad_down .content_down .down_content span {
  372. /* color: #333; */
  373. position: absolute;
  374. /* top: 10px; */
  375. right: 10px;
  376. }
  377. .content2 .content_ad_down .content_down .down_content a {
  378. color: #333;
  379. }
  380. .content2 .content_ad_down .content_down .down_content a:hover {
  381. color: #777;
  382. }
  383. .content2 .content_arc {
  384. /* border: 1px solid #000; */
  385. width: 510px;
  386. margin: 20px 0;
  387. border-radius: 0.7em;
  388. background: rgba(255, 255, 255, 1);
  389. }
  390. .content2 .content_arc .arc_title {
  391. border-bottom: 1px solid #eaeaea;
  392. height: 35px;
  393. line-height: 35px;
  394. }
  395. .content2 .content_arc .arc_title span {
  396. display: inline-block;
  397. height: 35px;
  398. margin-left: 15px;
  399. cursor: pointer;
  400. color: #333;
  401. }
  402. .content2 .content_arc .arc_title span:first-of-type {
  403. border-bottom: 1px solid #f80303;
  404. }
  405. .content2 .content_arc .arc_content ul li {
  406. margin: 7px 10px;
  407. position: relative;
  408. }
  409. .content2 .content_arc .arc_content ul li span:first-of-type {
  410. display: inline-block;
  411. width: 75px;
  412. /* border: 1px solid red; */
  413. text-align: right;
  414. }
  415. .content2 .content_arc .arc_content ul li span {
  416. margin: 0 3px;
  417. color: #999;
  418. }
  419. .content2 .content_arc .arc_content ul li span:last-of-type {
  420. display: inline-block;
  421. position: absolute;
  422. top: 3px;
  423. right: 5px;
  424. color: #f20b0b;
  425. }
  426. .content2 .content_arc .arc_content ul li a {
  427. margin-left: 2px;
  428. color: #333;
  429. }
  430. .content2 .content_arc .arc_content ul li a:hover {
  431. color: #777;
  432. }
  433. .content2 .content_qa {
  434. width: 310px;
  435. margin: 20px 0;
  436. /* border: 1px solid #000; */
  437. border-radius: 0.7em;
  438. background: rgba(255, 255, 255, 1);
  439. }
  440. .content2 .content_qa .qa_title {
  441. border-bottom: 1px solid #eaeaea;
  442. height: 35px;
  443. line-height: 35px;
  444. }
  445. .content2 .content_qa .qa_title span {
  446. margin-left: 15px;
  447. color: #333;
  448. }
  449. .content2 .content_qa .qa_content ul li {
  450. margin: 10px 20px;
  451. }
  452. .content2 .content_qa .qa_content ul li a {
  453. color: #333;
  454. }
  455. .content2 .content_qa .qa_content ul li a:hover {
  456. color: #777;
  457. }
  458. /* .search-related {
  459. border: 1px solid #000;
  460. } */
  461. .search-related .related_type {
  462. width: 230px;
  463. height: 390px;
  464. /* border: 1px solid lightsalmon; */
  465. }
  466. .search-related .related_type .type_title {
  467. height: 40px;
  468. line-height: 40px;
  469. padding-left: 10px;
  470. font-weight: bold;
  471. color: #666;
  472. background: #eee;
  473. font-size: 12px;
  474. border-right: 1px solid #fff;
  475. }
  476. .search-related .related_type .type_content {
  477. /* display: block; */
  478. height: 320px;
  479. background: #515773;
  480. border-right: 1px solid #fff;
  481. border-bottom-left-radius: 8px;
  482. }
  483. .search-related .related_type .type_content ul li {
  484. padding: 12px 0 0px 20px;
  485. }
  486. .search-related .related_type .type_content ul li a {
  487. color: #fff;
  488. font-size: 14px;
  489. }
  490. .search-related .related_type .type_content ul li a span {
  491. color: #bbbbbb;
  492. font-size: 12px;
  493. padding-left: 5px;
  494. }
  495. /* ------------------------- */
  496. .search-related .related_search {
  497. width: 970px;
  498. height: 390px;
  499. /* margin-bottom: 20px; */
  500. /* border: 1px solid lightseagreen; */
  501. }
  502. .search-related .related_search .search_title {
  503. height: 40px;
  504. line-height: 40px;
  505. padding-left: 10px;
  506. font-weight: bold;
  507. color: #666;
  508. background: #eee;
  509. font-size: 12px;
  510. }
  511. .search-related .related_search .search_title a {
  512. margin-right: 20px;
  513. padding-bottom: 10px;
  514. display: block;
  515. height: 40px;
  516. line-height: 40px;
  517. padding: 0 10px;
  518. font-size: 12px;
  519. font-weight: bold;
  520. color: #666;
  521. }
  522. .search-related .related_search .search_title a:first-of-type {
  523. color: #fff;
  524. background: #515773;
  525. }
  526. .search-related .related_search .search_content {
  527. height: 320px;
  528. background: #515773;
  529. padding: 30px;
  530. border-bottom-right-radius: 8px;
  531. }
  532. .search-related .related_search .search_content .sc_title {
  533. font-size: 2em;
  534. font-weight: bold;
  535. color: #e4e0e0;
  536. margin: 10px auto;
  537. }
  538. .search-related .related_search .search_content .sc_title2 {
  539. margin: 5px auto;
  540. color: #fff;
  541. }
  542. .search-related .related_search .search_content .search_div {
  543. width: 80%;
  544. height: 50px;
  545. line-height: 50px;
  546. margin: 20px auto;
  547. color: #fff;
  548. /* border: 1px solid #000; */
  549. background: #fff;
  550. position: relative;
  551. }
  552. .search-related .related_search .search_content .search_div span:first-of-type {
  553. display: inline-block;
  554. width: 50px;
  555. height: 50px;
  556. color: #333;
  557. text-align: center;
  558. }
  559. .search-related .related_search .search_content .search_div input {
  560. border-style: none;
  561. width: 80%;
  562. height: 48px;
  563. }
  564. .search-related .related_search .search_content .search_div button {
  565. display: block;
  566. border-style: none;
  567. background: none;
  568. height: 50px;
  569. line-height: 50px;
  570. color: #fff;
  571. margin: 0 auto;
  572. }
  573. .search-related .related_search .search_content .search_div span:last-of-type {
  574. position: absolute;
  575. right: 0;
  576. width: 100px;
  577. height: 50px;
  578. background: #98a1ad;
  579. }
  580. .search-related .related_search .search_content .hot_key {
  581. margin-bottom: 25px;
  582. color: #fff;
  583. }
  584. .search-related .related_search .search_content .hot_key span {
  585. display: inline-block;
  586. color: #fff;
  587. background: #898c87;
  588. font-size: 12px;
  589. text-align: center;
  590. border-radius: 8px;
  591. height: 35px;
  592. line-height: 35px;
  593. padding: 0 5px;
  594. margin: 10px;
  595. }
  596. .search-related .related_search .search_content .ls_key {
  597. margin-top: -20px;
  598. color: #fff;
  599. }
  600. .content3 {
  601. background: #fff;
  602. /* border-radius: 8px; */
  603. height: 635px;
  604. }
  605. .content3 .content3_title {
  606. text-align: center;
  607. font-size: 20px;
  608. font-weight: 600;
  609. color: #4d555d;
  610. line-height: 30px;
  611. padding-top: 20px;
  612. padding-bottom: 10px;
  613. }
  614. .content3 .content3_content {
  615. /* border: 1px solid #000; */
  616. padding: 10px;
  617. }
  618. .content3 .content3_content .content_left ul li {
  619. position: relative;
  620. }
  621. .content3 .content3_content .content_left .ct3_left_ad img {
  622. width: 217px;
  623. height: 364px;
  624. border-radius: 8px;
  625. margin-bottom: 18px;
  626. }
  627. .content3 .content3_content .content_left ul li img {
  628. width: 217px;
  629. height: 124px;
  630. border-radius: 8px;
  631. border: none;
  632. }
  633. .content3 .content3_content .content_left ul li span {
  634. position: absolute;
  635. top: 124px;
  636. left: 0;
  637. /* bottom: -50px; */
  638. width: 217px;
  639. height: 42px;
  640. background-color: #fff;
  641. color: #93999f;
  642. font-size: 12px;
  643. line-height: 42px;
  644. padding: 0 20px;
  645. border-bottom-left-radius: 8px;
  646. border-bottom-right-radius: 8px;
  647. box-shadow: 0 4px 8px 0 rgba(7, 17, 27, 0.1);
  648. }
  649. .content3 .content3_content .content_left ul li a {
  650. display: block;
  651. border-radius: 8px;
  652. padding: 15px 20px;
  653. position: absolute;
  654. top: 86px;
  655. transition: top 0.3s;
  656. height: 80px;
  657. width: 217px;
  658. background: #e2e2e2;
  659. color: #555;
  660. }
  661. .content3 .content3_content .content_left ul li a:hover {
  662. color: #333;
  663. top: 45px;
  664. }
  665. /* 点击次数
  666. .content3 .content3_content .content_left ul li span {
  667. position: absolute;
  668. bottom: -36px;
  669. width: 100%;
  670. height: 42px;
  671. background-color: #fff;
  672. color: #93999f;
  673. font-size: 12px;
  674. line-height: 42px;
  675. padding: 0 20px;
  676. border-bottom-left-radius: 8px;
  677. border-bottom-right-radius: 8px;
  678. box-shadow: 0 4px 8px 0 rgba(7, 17, 27, 0.1);
  679. }
  680. .content3 .content3_content .content_left ul li a {
  681. display: block;
  682. border-radius: 8px;
  683. padding: 15px 20px;
  684. position: absolute;
  685. top: 83px;
  686. transition: top 0.3s;
  687. height: 80px;
  688. width: 100%;
  689. background: #e2e2e2;
  690. color: #555;
  691. }
  692. .content3 .content3_content .content_left ul li a:hover {
  693. color: #333;
  694. top: 46px;
  695. } */
  696. .content3 .content3_content .content_right {
  697. width: 100%;
  698. /* border: 1px solid yellowgreen; */
  699. margin-left: 20px;
  700. }
  701. /* 右---------------------------------------- */
  702. .content3 .content3_content .content_right ul li {
  703. position: relative;
  704. /* margin: 30px 5px; */
  705. height: 192px;
  706. }
  707. .content3 .content3_content .content_right ul li img {
  708. width: 217px;
  709. height: 124px;
  710. border-radius: 8px;
  711. border: none;
  712. }
  713. .content3 .content3_content .content_right ul li span {
  714. position: absolute;
  715. top: 124px;
  716. left: 0;
  717. /* bottom: -50px; */
  718. width: 217px;
  719. height: 42px;
  720. background-color: #fff;
  721. color: #93999f;
  722. font-size: 12px;
  723. line-height: 42px;
  724. padding: 0 20px;
  725. border-bottom-left-radius: 8px;
  726. border-bottom-right-radius: 8px;
  727. box-shadow: 0 4px 8px 0 rgba(7, 17, 27, 0.1);
  728. }
  729. .content3 .content3_content .content_right ul li a {
  730. display: block;
  731. border-radius: 8px;
  732. padding: 15px 20px;
  733. position: absolute;
  734. top: 86px;
  735. transition: top 0.3s;
  736. height: 80px;
  737. width: 217px;
  738. background: #e2e2e2;
  739. color: #555;
  740. }
  741. .content3 .content3_content .content_right ul li a:hover {
  742. color: #333;
  743. top: 50px;
  744. }
  745. .footer {
  746. padding: 20px;
  747. background: #393d49;
  748. color: #787d82;
  749. }
  750. .footer .footer_left .footer_link a {
  751. margin: 0 10px;
  752. color: #c8cdd2;
  753. }
  754. .footer .footer_left .footer_link a:hover {
  755. color: #fff;
  756. }
  757. .footer .footer_left .footer_company span {
  758. /* font-size: 11px; */
  759. }
  760. .footer .footer_left .footer_company img {
  761. padding-top: 25px;
  762. width: 50px;
  763. }
  764. .footer .footer_left .copyright img {
  765. padding-top: 25px;
  766. width: 15px;
  767. }
  768. .footer .footer_left .copyright a {
  769. margin: 0 1px;
  770. color: #787d82;
  771. }
  772. .footer .footer_left .copyright a:hover {
  773. color: #fff;
  774. }
  775. .footer .footer_left .add_tel {
  776. padding-top: 25px;
  777. }
  778. .footer .footer_left .code{
  779. position: relative;
  780. }
  781. .footer .footer_left .code img:last-of-type {
  782. margin: 3px;
  783. width: 100px;
  784. position: absolute;
  785. top: -150px;
  786. right: 2%;
  787. }
  788. .footer .footer_left .code img:first-of-type {
  789. margin: 3px;
  790. width: 100px;
  791. position: absolute;
  792. top: -150px;
  793. right: 12%;
  794. }

CSS样式:通用部分

  1. * {
  2. margin: 0;
  3. padding: 0;
  4. box-sizing: border-box;
  5. }
  6. html,
  7. body {
  8. width: 100%;
  9. height: 100%;
  10. overflow: hidden;
  11. overflow-y: auto;
  12. font: 14px Helvetica Neue,Helvetica,PingFang SC,微软雅黑,Tahoma,Arial,sans-serif;
  13. background: #F3F5F7;
  14. }
  15. li,dd{
  16. list-style: none;
  17. }
  18. a{
  19. text-decoration: none;
  20. }
  21. button,img{
  22. border: none;
  23. outline: none;
  24. }
  25. /* 过渡动画: */
  26. .navTs{
  27. transition:all 200ms ease;
  28. }
  29. .container {
  30. width: 1200px;
  31. margin: 0 auto;
  32. }
  33. /* 转为flex容器 */
  34. .flexDis {
  35. display: flex;
  36. }
  37. /* flex项目收缩比例:不收缩 */
  38. .flexShrinkStatic {
  39. flex-shrink: 0;
  40. }
  41. /* flex项目收缩比例:等比收缩 */
  42. .flexShrinkAuto {
  43. flex-shrink: 1;
  44. }
  45. /* flex项目放大比例: */
  46. .flexGrowAuto {
  47. flex-grow: 1;
  48. }
  49. /* flex主轴排列:水平排列 */
  50. .flexDir-x {
  51. flex-direction: row;
  52. }
  53. /* flex主轴排列:垂直排列 */
  54. .flexDir-y {
  55. flex-direction: column;
  56. }
  57. /* flex主轴换行:换行 */
  58. .flexWrap {
  59. flex-wrap: wrap;
  60. }
  61. /* flex主轴换行:不换行 */
  62. .flexNoWrap {
  63. flex-wrap: nowrap;
  64. }
  65. /* 主轴水平对齐方式-------------------------------------- */
  66. /* flex主轴对齐方式:左对齐 */
  67. .flexContentS {
  68. justify-content: start;
  69. }
  70. /* flex主轴对齐方式:右对齐 */
  71. .flexContentE {
  72. justify-content: end;
  73. }
  74. /* flex主轴对齐方式:中对齐 */
  75. .flexContentC {
  76. justify-content: center;
  77. }
  78. /* flex主轴对齐方式:均匀排列每个元素,每个元素之间的间隔相等 */
  79. .flexContentV {
  80. justify-content: space-evenly;
  81. }
  82. /* flex主轴对齐方式:均匀排列每个元素,首个元素放置于起点末尾元素放置于终点 */
  83. .flexContentB {
  84. justify-content: space-between;
  85. }
  86. /* flex主轴对齐方式:均匀排列每个元素,元素之前、之间、之后都留有空白的容器内。 */
  87. .flexContentA {
  88. justify-content: space-around;
  89. }
  90. /* 主轴垂直对齐方式-------------------------------------- */
  91. /* 行内上对齐-定义flex子项在flex容器的当前行的侧轴(纵轴)方向上的对齐方式。 */
  92. .flexAlignS {
  93. align-items: start;
  94. }
  95. /* 行内中对齐-定义flex子项在flex容器的当前行的侧轴(纵轴)方向上的对齐方式。 */
  96. .flexAlignC {
  97. align-items: center;
  98. }
  99. /* 行内下对齐-定义flex子项在flex容器的当前行的侧轴(纵轴)方向上的对齐方式。 */
  100. .flexAlignE {
  101. align-items: end;
  102. }
  103. /* 元素位于容器的基线上。-定义flex子项在flex容器的当前行的侧轴(纵轴)方向上的对齐方式。 */
  104. .flexAlignB {
  105. align-items: baseline;
  106. }
  107. /* 默认值。元素被拉伸以适应容器。-定义flex子项在flex容器的当前行的侧轴(纵轴)方向上的对齐方式。 */
  108. .flexAlignT {
  109. align-items: stretch;
  110. }

总结:

通过学习Flex布局,能基本模仿出基本样式,弹性盒子的优点是自适应,这里使用的基本为像素单位,有些还未定义尺寸,由内容撑开,当图片确失或未加载,会导致布局错乱,需要在后期学习中不断改进。

声明:本文内容转载自脚本之家,由网友自发贡献,版权归原作者所有,如您发现涉嫌抄袭侵权,请联系admin@php.cn 核实处理。
全部评论
文明上网理性发言,请遵守新闻评论服务协议
老周2020-06-29 19:22:161楼
demo地址: http://106.13.227.76/demo/