如何用html+css 写出百度界面 文章目录 如何用html+css 写出百度界面 一、效果如下 二、代码 2.css样式 总结 一、效果如下
二、代码 代码如下(示例): index.html
Document
百度热搜
换一换
2.css样式 代码如下(示例):
* {
margin: 0;
padding: 0;
}
body,
html {
height: 100%;
width: 100%;
}
ul,
li {
list-style: none;
}
.l {
float: left;
}
.r {
float: right;
}
.boxs {
color: #4e6ef2;
}
.nav {
position: absolute;
width: 100%;
height: 60px;
}
.nav ul {
margin-left: 24px;
padding-top: 19px ;
}
.nav ul li {
float: left;
padding-right: 24px;
}
.nav ul li a {
color: #222;
font-size: 13px;
text-decoration: none;
}
.nav .nav-r {
padding-right: 24px;
display: flex;
}
.nav .nav-r a {
display: block;
margin: 0 0 0 32px;
font-size: 12px;
text-decoration: none;
color: #222;
}
.nav .nav-r a.nav-dl {
width: 48px;
height: 24px;
color: #fff;
background-color: #4e6ef2;
line-height: 24px;
text-align: center;
border-radius: 7px;
}
.nav .nav-r a.nav-p {
padding-top: 6px;
position: relative;
}
.nav .nav-r a.nav-p:hover .a-item {
display: block;
}
.nav .nav-r a.nav-p .a-item {
display: none;
position: absolute;
top: 30px;
left: -30px;
width: 84px;
height: auto;
box-shadow: 0 0 2px #333;
border-radius: 10px;
}
.nav .nav-r a.nav-p .a-item p {
text-align: center;
line-height: 25px;
}
.container {
width: 654px;
height: 100%;
margin: 0 auto;
}
.container .logo {
width: 100%;
height: 188px;
position: relative;
}
.container .logo img {
position: absolute;
left: 50%;
top: 60px;
transform: translate(-50%);
width: 270px;
height: 129px;
}
.container .form-input {
position: relative;
margin-top: 15px;
}
.container .form-input span {
font-size: 25px;
color: #ccc;
position: absolute;
right: 160px;
top: 10px;
cursor: pointer;
}
.container .form-input span:hover {
color: #4e6ef2;
}
.container .form-input input {
width: 530px;
height: 40px;
outline: none;
border: 2px solid #ccc;
border-radius: 7px 0 0 7px;
text-indent: 15px;
}
.container .form-input input:focus {
border: 2px solid #4e6ef2;
}
.container .form-input button {
width: 108px;
height: 44px;
border: none;
color: #fff;
font-size: 16px;
background-color: #4e6ef2;
border-radius: 0 7px 7px 0;
position: absolute;
right: 39px;
cursor: pointer;
}
.container .newsContainer {
width: 100%;
height: 24px;
margin: 45px auto 0;
}
.container .newsContainer .containerNva span {
cursor: pointer;
}
.container .newsContainer .containerNva span:first-child {
color: #000;
font-weight: bold;
}
.container .newsContainer .containerNva span:last-child {
font-weight: 400;
color: #9195a3;
font-size: 15px;
}
.container .newsContainer .containerNva span:hover {
color: #4e6ef2;
}
.container .newsContainer .containerNva::before {
content: '';
}
.container .newsContainer .containerNva::after {
content: '';
display: block;
clear: both;
}
.container .newsContainer .newList .icon {
color: #fff;
font-size: 12px;
background-color: #f60;
padding: 0 2px;
border-radius: 4px;
font-weight: 200;
}
.container .newsContainer .newList .navList-l li {
width: 306px;
height: 36px;
line-height: 36px;
}
.container .newsContainer .newList .navList-l li a {
color: #000;
text-decoration: none;
margin-left: 10px ;
}
.container .newsContainer .newList .navList-l li a.color_a {
color: #9195a3;
}
.container .newsContainer .newList .navList-l li a:hover {
color: #4e6ef2;
text-decoration: underline;
}
.container .newsContainer .newList .navList-l li span.item1 {
color: #f63051;
}
.container .newsContainer .newList .navList-l li span.item2 {
color: #fe2d46;
}
.container .newsContainer .newList .navList-l li span.item3 {
color: #f60;
}
.container .newsContainer .newList .navList-r li {
width: 306px;
height: 36px;
line-height: 36px;
}
.container .newsContainer .newList .navList-r li .iconNew {
color: #fff;
font-size: 12px;
background-color: #ff455b;
padding: 0 2px;
border-radius: 4px;
font-weight: 200;
}
.container .newsContainer .newList .navList-r li a {
color: #000;
text-decoration: none;
margin-left: 10px ;
}
.container .newsContainer .newList .navList-r li a:hover {
color: #4e6ef2;
text-decoration: underline;
}
.container .newsContainer .newList .navList-r li a.color_a {
color: #9195a3;
}
.container .newsContainer .newList .navList-r li span.item1 {
color: #faa90e;
}
.container .newsContainer .newList .navList-r li span.item2 {
color: #9195a3;
}
.container .newsContainer .newList .navList-r li span.item3 {
color: #9195a3;
}
.bottom {
width: 100%;
height: 40px;
position: absolute;
bottom: 0px;
line-height: 40px;
}
.bottom .bottom-a {
display: flex;
justify-content: center;
}
.bottom .bottom-a a {
color: #9195a3;
text-decoration: none;
font-size: 12px;
margin-right: 20px;
}
.bottom .bottom-a a:hover {
color: #000;
}
@font-face {
font-family: 'iconfont';
src: url('/font_mb15ndqztod/iconfont.ttf?t=1647692926765') format('truetype');
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
总结 素材在我的另一个文章里
