时间:2023-07-25 09:39:01 | 来源:网站运营
时间:2023-07-25 09:39:01 来源:网站运营
Part1 HTML网页开发 模块4 移动端开发:文章内容输出来源:拉勾教育大前端就业集训营
<!-- 二倍图-img标签实例 --><img src="./images/gold-coin@2x.png" width="50" height="50" alt="@2x">
背景图同样需要考虑设置尺寸处理,因设别分辨率原因带来的图片模糊问题div.bg-img{ width: 50px; height: 50px; /* 选用二倍图 */ background-image: url(./images/gold-coin@2x.png); /* 设置尺寸大小 */ background-size: 50px 50px; }<!-- 二倍图-背景图实例 --><div class="bg-img"></div>
<!-- 顶部tips 区域开始 --> <div class="top-tips"> <div class="close-btn"><img src="https://m.360buyimg.com/mobilecms/jfs/t19480/10/1439571805/820/787bec2c/5ac9d730N04e6d766.png" alt="关闭按钮图片"></div> <div class="logo"><img src="https://img11.360buyimg.com/jdphoto/s80x80_jfs/t27847/91/107794072/6854/14716732/5b850ecaN644d2983.png" alt="京东LOGO图片"></div> <div class="text">打开京东App,购物更轻松</div> <div class="open-app">立即打开</div> </div> <!-- 顶部tips 区域结束 -->
/* <!-- 顶部tips 区域 --> *//* 父级容器 */.top-tips{ width: 100%; height: 45px; background-color: #232326; color: #fff; text-align: center; line-height: 45px;}/* 子元素 */.top-tips div{ float: left;}/* 1、关闭按钮 */.top-tips .close-btn{ width: 8%;}.top-tips .close-btn img{ width: 10px; vertical-align: middle;}/* 2、LOGO */.top-tips .logo{ width: 10%;}.top-tips .logo img{ width: 30px; vertical-align: middle;}/* 3、文本提示 */.top-tips .text{ width: 57%;}/* 4、打开app按钮 */.top-tips .open-app{ width: 25%; height: 45px; background-color: #F63515;}
<!-- 顶部search区域 开始 --> <div class="top-search_box"> <div class="menu_left"> <span></span> </div> <div class="input_center"> <span class="jd-logo"></span> <span class="search-icon"></span> <input class="input-area" type="search" placeholder="鼠标键盘套装"> </div> <div class="login_right">登录</div> </div> <!-- 顶部search区域 结束 -->
css/* <!-- 顶部search区域 开始 --> */.top-search_box{ position: fixed; left: 0; top: 45px; width: 100%; height: 45px; background-color: #F63515;}/* 1、左侧菜单 */.top-search_box .menu_left{ position: absolute; left: 0; top: 0; width: 40px; height: 45px;}.top-search_box .menu_left span{ display: block; width: 20px; height: 18px; margin: 14px 0 0 15px; background: url(../images/index_top-search_menu-icon.png) no-repeat 0 0; background-size: 20px 18px;}/* 2、中间输入部分 */.top-search_box .input_center{ position: relative; height: 30px; margin: 7px 50px; border-radius: 15px; background-color: #fff;}.top-search_box .input_center span.jd-logo{ position: relative; float: left; width: 20px; height: 15px; margin: 8px 8px 0 15px; background: url(../images/index_top-search_input_jd-logo.png) no-repeat 0 0; background-size: 20px 15px;}.top-search_box .input_center span.jd-logo::after{ position: absolute; right: -8px; content: ''; width: 1px; height: 15px; background-color: #ccc;}.top-search_box .input_center span.search-icon{ float: left; width: 18px; height: 15px; margin: 8px 0 0 15px; /* 精灵图二倍图处理 */ /* 缩小一半 */ background-size: 200px; /* 引入 */ background: url(../images/jd-sprites.png) no-repeat 0 0; /* icon定位 */ background-position: -82px 0;}.top-search_box .input_center input.input-area{ position: absolute; left: 0; top: 0; width: 100%; height: 30px; padding: 0 20px 0 78px; border: none; background-color: transparent; font-size: 12px; /* 清除聚焦时的边框 */ outline: none;}/* 3、右侧登录 */.top-search_box .login_right{ position: absolute; right: 0; top: 0; width: 40px; height: 45px; color: #fff; text-align: left; line-height: 45px;}
/* 轮播图 */.banner ul.carousel{ position: relative; margin: 0; list-style: none;}.banner ul.carousel li{ position: absolute; top: 0; left: 0; box-sizing: border-box; width: 100%; height: 200px; padding: 45px 3.33% 0;}.banner ul.carousel li:nth-child(2){ left: 100%;}.banner ul.carousel li:nth-child(3){ left: 200%;}.banner ul.carousel li:nth-child(4){ left: 300%;}.banner ul.carousel li:nth-child(5){ left: 400%;}.banner ul.carousel li:nth-child(6){ left: 500%;}.banner ul.carousel li:nth-child(7){ left: 600%;}.banner ul.carousel li:nth-child(8){ left: 700%;}.banner ul.carousel li a{ display: block;}.banner ul.carousel li a img{ display: block; width: 100%; border-radius: 10px;}
/* 顶部搜索框 */.top-search{ display: flex; align-items: center; box-sizing: border-box; width: 100%; padding-left: 12px; padding-right: 4px;}/* - 左侧搜索盒子 */.top-search .search-box-left{ flex: 1; display: flex; align-items: center; box-sizing: border-box; height: 28px; padding: 2px 5px; border-radius: 14px; background-color: #fff;}.top-search .search-box-left::before{ content: ''; width: 35px; height: 28px; background: url(../images/home-common-sprite2x@v7.15.png) no-repeat 15px 7px; background-size: 21px auto;}.top-search .search-box-left span{ font-size: 15px; color: #666;}/* - 右侧我的 */.top-search .mine-right{ display: flex; flex-direction: column; justify-content: center; align-items: center; width: 51px; height: 44px;}.top-search .mine-right::before{ content: ''; display: block; width: 22px; height: 22px; background: url(../images/home-common-sprite2x@v7.15.png) no-repeat 0px -36px; background-size: 21px auto;}.top-search .mine-right span{ font-size: 12px; color: #fff; line-height: 12px;}
div.banner{ width: (750rem / @baseSize); height: (260rem / @baseSize); background: url(../images/banner_bg.png) no-repeat 0 0; background-size: (750rem / @baseSize) auto; div.wrapper{ position: relative; width: (702rem / @baseSize); height: 100%; border-radius: (24rem / @baseSize); margin: 0 (24rem / @baseSize); background-color: yellow; overflow: hidden; ul.carousel{ position: relative; width: (2000rem / @baseSize); height: 100%; li{ position: absolute; left: (702rem / @baseSize); top: 0; width: (702rem / @baseSize); height: 100%; &.current{ left: 0; } a{ width: 100%; img{ width: 100%; height: 100%; } } } } ol.index-btn{ position: absolute; bottom: (12rem / @baseSize); left: 0; display: flex; justify-content: center; align-items: center; width: 100%; height: (10rem / @baseSize); li{ width: (8rem / @baseSize); height: (8rem / @baseSize); border-radius: (8rem / @baseSize); margin: 0 (5rem /@baseSize); background-color: rgba(0, 0, 0, 0.3); &.current{ width: (18rem / @baseSize); background-color: #fff; } } } }}
<!-- 规定IE浏览器使用最新内核渲染 --> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <!-- 理想视口配置 --> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>04-bootstrap-布局容器</title> <!-- 引入bootstrap样式表 --> <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"> <!-- IE浏览器兼容html5 和 媒体查询 --> <!--[if lt IE 9]> <script src="https://cdn.jsdelivr.net/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/respond.js@1.4.2/dest/respond.min.js"></script> <![endif]-->
关键词:移动