浏览器窗口图标设置
如图,在浏览器中要实现以下效果:
红色字体本质是一个图标,实现过程如下:
1.准备一张后缀为.png ,.jpg格式的图片
2.把图片转换成.ico格式的图标,可利用www.bitbug.net 进行转换
用以下代码引入html的<head>标签中:
<link rel="shortcut icon" href="图标存放路径" type="image/x-icon" />>
网站优化的三大标签
title:网站标题,一般是网站名+简单描述,位置越靠前,权重越高。一般不超过28个字。
desription:网站描述。不超过120个字。
keywords:一般关键词在6~8个。
代码参考如下:
<meta name="品优购" content="一个致力于网上购物的平台">
<!-- 网站说明 -->
<meta name="description" content="品优购商城-专业的综合网上购物商城,销售家电、数码通讯、电脑、家居百货、服装服饰、母婴、图书、食品等数万个品牌优质商品.便捷、诚信的服务,为您提供愉悦的网上购物体验!" />
<!-- 关键字 -->
<meta name="keywords" content="网上购物,网上商城,手机,笔记本,电脑,MP3,CD,VCD,DV,相机,数码,配件,手表,存储卡" />
表单界面
代码如下:
html:
<header>
<div class="line w">
<div class="logo"></div>
</div>
</header>
<div class="registerarea w">
<form action="#">
<div class="register_title">
<h3>注册新用户</h3>
<p>我有账号,去<a href="#">登录</a></p>
</div>
<div class="register_body">
<ul>
<li>
<label>手机号:</label>
<input type="text">
<span class="error">
<i class="error_icon"></i>
手机号码不正确,请重新输入
</span>
</li>
<li>
<label>短信验证码:</label>
<input type="text">
<span class="correct">
<i class="correct_icon"></i>
短信验证码输入正确
</span>
</li>
<li>
<label>登录密码:</label>
<input type="password">
<span class="error">
<i class="error_icon"></i>
密码格式不正确,请重新输入
</span>
</li>
<li class="safe">
安全程度
<span class="ruo">弱</span>
<span class="zhong">中</span>
<span class="qiang">强</span>
</li>
<li>
<label>确认密码</label>
<input type="password">
<span class="error">
<i class="error_icon"></i>
密码错误,请重新输入
</span>
</li>
<li class="agree">
<input type="checkbox" class="agree_border">同意协议并注册 <a href="#">《知晓用户协议》</a>
</li>
<li class="finish_to_reg">
<button>完成注册</button>
</li>
</ul>
</div>
</form>
</div>
<footer>
<!-- mod_copyright -->
<div class="mod_copyright">
<p class="mod_copyright_links">
关于我们 | 联系我们 | 联系客服 | 商家入驻 | 营销中心 | 手机品优购 | 友情链接 | 销售联盟 | 品优购社区 | 品优购公益 | English Site | Contact U
</p>
<p class="mod_copyright_info">
地址:北京市昌平区建材城西路金燕龙办公楼一层 邮编:100096 电话:400-618-4000 传真:010-82935100 邮箱: zhanghj+itcast.cn <br> 京ICP备08001421号京公网安备110108007702
</p>
</div>
</footer>
common.css:
/* 公共样式 */
.fl {
float: left;
}
.fr {
float: right;
}
.w {
width: 1200px;
margin: 0 auto;
}
/* 引入字体图标 */
@font-face {
font-family: 'iconfont';
src: url('../fonts/icomoon.eot?tomleg');
src: url('../fonts/icomoon.eot?tomleg#iefix') format('embedded-opentype'), url('../fonts/icomoon.ttf?tomleg') format('truetype'), url('../fonts/icomoon.woff?tomleg') format('woff'), url('../fonts/icomoon.svg?tomleg#icomoon') format('svg');
font-weight: normal;
font-style: normal;
font-display: block;
}
/* 字体红色 */
.style-red {
color: #c81623;
}
/* 顶部快捷导航 */
.shortcut {
height: 31px;
background-color: #f1f1f1;
line-height: 31px;
}
.shortcut li {
float: left;
}
.spacer {
width: 1px;
height: 12px;
background-color: #666;
margin: 9px 12px 0;
}
.shortcut .fr a {
font-family: 'iconfont';
}
/* 头部 */
header {
position: relative;
height: 105px;
}
.logo {
position: absolute;
top: 23px;
height: 58px;
width: 176px;
background: url(../images/logo.png) no-repeat center;
}
.search {
position: absolute;
left: 347px;
top: 23px;
width: 544px;
height: 37px;
box-sizing: border-box;
}
.search input {
width: 454px;
height: 33px;
outline: none;
text-indent: 5px;
border: 2px solid #b1191a;
}
.search button {
position: relative;
left: -5px;
height: 37px;
width: 80px;
background-color: #c81623;
color: #f1f1f1;
border: none;
border-left: 2px solid #c81623;
outline: none;
}
.shopcart {
position: absolute;
top: 23px;
right: 64px;
width: 140px;
height: 34px;
line-height: 34px;
text-align: center;
background-color: #f7f7f7;
border: 1px solid #dfdfdf;
box-sizing: border-box;
}
.shortcut a {
text-align: center;
}
.shopcart a::before {
font-family: 'iconfont';
content: "\e93a ";
color: #c81623;
}
.shopcart a::after {
font-family: 'iconfont';
content: " \e920";
}
.shopcart .shape {
position: absolute;
top: -8px;
right: 20px;
height: 14px;
width: 17px;
border-radius: 50% 50% 50% 0;
background-color: #c81623;
z-index: 0;
}
.shopcart p {
position: absolute;
top: -18px;
right: 20px;
height: 14px;
width: 17px;
color: #dfdfdf;
z-index: 1;
}
.hotwords li {
float: left;
margin-right: 20px;
}
.hotwords {
position: absolute;
left: 360px;
top: 65px;
}
nav {
height: 45px;
border-bottom: 2px solid #b1191a;
}
.dropdown {
height: 45px;
width: 209px;
margin-right: 10px;
}
.dropdown .th {
width: 100%;
height: 100%;
line-height: 45px;
background-color: #b1191a;
text-align: center;
color: #fff;
font-size: 16px;
}
.dropdown .tb {
width: 100%;
height: 465px;
margin-top: 2px;
background-color: #c81623;
}
.dropdown .tb li {
height: 31px;
width: 100%;
line-height: 31px;
padding-left: 10px;
box-sizing: border-box;
font-size: 14px;
}
.dropdown .tb li a {
display: inline-block;
width: 100%;
height: 32px;
line-height: 32px;
border-left: 1px solid transparent;
color: #fff;
}
.dropdown .tb li a span {
font-family: 'iconfont';
float: right;
margin-right: 10px;
color: #fff;
}
.dropdown .tb li:hover {
background-color: #fff;
border-left: 1px solid #c81623;
}
.dropdown .tb li:hover a {
color: #c81623;
}
.navitems li {
float: left;
}
.navitems li a {
display: block;
height: 45px;
line-height: 45px;
font-size: 16px;
padding: 0 25px;
}
/* footer底部 */
footer {
height: 416px;
background-color: #f5f5f5;
padding-top: 30px;
box-sizing: border-box;
}
.mod_service {
height: 79px;
border-bottom: 1px solid #ccc;
}
.mod_service li {
float: left;
width: 240px;
height: 79px;
box-sizing: border-box;
}
.mod_service_icon {
float: left;
width: 50px;
height: 50px;
border: 50%;
margin-left: 35px;
background-image: url(../images/icons.png);
}
.mod_service_zheng {
background-position: -253px -3px;
}
.mod_service_deliver {
background-position: -255px -54px;
}
.mod_service_shouhou {
background-position: -257px -106px;
}
.mod_service_tese {
background-position: -257px -157px;
}
.mod_service_help {
background-position: -258px -209px;
}
.mod_service_title {
float: left;
margin-left: 5px;
}
.mod_service_title h5 {
margin: 5px 0;
}
.mod_help {
height: 187px;
border-bottom: 1px solid #ccc;
}
.mod_help_item {
float: left;
width: 150px;
padding: 20px 0 0 50px;
}
.mod_help_item dt {
height: 25px;
font-size: 16px;
}
.mod_help_item dd {
height: 22px;
}
.mod_help_app dt,
.mod_help_app p {
padding-left: 15px;
}
.mod_help_app img {
margin: 7px 0;
}
.mod_copyright {
text-align: center;
}
.mod_copyright_links {
margin: 20px 0 15px 0;
}
.mod_copyright_info {
line-height: 18px;
}
base.css
/* 基础样式 */
/* 清除元素默认的的内外边距 */
* {
margin: 0;
padding: 0;
}
/* 让所有斜体 不倾斜 */
i,
em {
font-style: normal;
}
/* 去掉列表前面的小点 */
li {
list-style: none;
}
/* 图片没有边框,去掉图片低侧的空白缝隙 */
img {
border: 0;
vertical-align: middle;
}
/* 让button按钮变小手 */
button {
cursor: pointer;
}
/* 取消链接的下划线 */
a {
color: #666;
text-decoration: none;
}
a:hover {
color: #e33333;
}
button,
input {
font-family: 'Microsoft YaHei', 'Heiti SC', tahoma, arial, 'Hiragino Sans GB', \\5B8B\4F53, sans-serif;
/*取消轮廓线 蓝色的*/
outline: none;
}
body {
background-color: #fff;
font: 12px/1.5 'Microsoft YaHei', 'Heiti SC', tahoma, arial, 'Hiragino Sans GB', \\5B8B\4F53, sans-serif;
color: #666
}
/* 清除浮动 */
.clearfix::before,
.clearfix::after {
content: "";
display: table;
}
.clearfix::after {
clear: both;
}
.clearfix {
*zoom: 1;
}
.hidden,
.none {
display: none;
}
body {
font: 12px/1.5 Microsoft YaHei, Heiti SC, tahoma, arial, Hiragino Sans GB, "\5B8B\4F53", sans-serif;
}
register.css
.line {
margin-top: 10px;
height: 84px;
border-bottom: 2px solid #c81523;
}
.register_title {
height: 42px;
line-height: 42px;
background-color: #ececec;
text-align: center;
border-bottom: 1px solid #ccc;
}
.register_title h3 {
float: left;
margin-left: 10px;
font-weight: 400;
font-size: 18px;
}
.register_title p {
float: right;
margin-right: 20px;
font-size: 14px;
}
.register_title p a {
color: #c81523;
}
section {
border-bottom: none;
}
.registerarea {
border: 1px solid #ccc;
}
.register_body {
padding: 50px 0px;
}
.register_body ul li {
width: 600px;
height: 37px;
line-height: 37px;
margin: 0px auto 20px;
}
.register_body ul li label {
display: inline-block;
height: 18px;
width: 88px;
text-align: center;
}
.register_body ul li input {
height: 37px;
width: 242px;
border: 1px solid #ccc;
}
.register_body.agree {
height: 18px;
line-height: 18px;
text-align: center;
}
.register_body .agree_border {
height: 13px;
width: 13px;
margin-left: 95px;
margin-right: 5px;
vertical-align: middle;
}
.register_body .agree a {
color: skyblue;
}
.finish_to_reg button {
margin-left: 100px;
width: 200px;
height: 34px;
background-color: #c81523;
border: none;
color: #fff;
}
.error {
color: #c81523;
}
.correct {
color: #008000;
}
.register_body ul li i {
display: inline-block;
height: 20px;
width: 20px;
vertical-align: middle;
}
.correct_icon {
background: url(../images/success.png) no-repeat center;
}
.error_icon {
background: url(../images/error.png) no-repeat center;
}
.safe {
padding-left: 180px;
height: 18px;
box-sizing: border-box;
}
.safe span {
display: inline-block;
width: 36px;
height: 16px;
line-height: 16px;
color: #fff;
text-align: center;
vertical-align: text-bottom;
}
.ruo {
background-color: #de1111;
}
.zhong {
background-color: #40b83f;
}
.qiang {
background-color: #f79100;
}