在小型媒体查询菜单中没有设置它在中等或Xtra小中的工作
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在小型媒体查询菜单中没有设置它在中等或Xtra小中的工作相关的知识,希望对你有一定的参考价值。
@import url('https://fonts.googleapis.com/css?family=Dosis');
* {
box-sizing: border-box;
}
/*Xtra Small */
body {
font-family: 'Dosis', sans-serif;
line-height: 1.618em;
font-size: 18px;
background: #383231;
color: #454545;
}
.main-container {
width: 100%;
position: relative;
margin: 0 auto;
background: #fff;
overflow: hidden;
}
.header-img {
text-align: center;
}
.header-img img {
width: 232px;
height: 232px;
border-radius: 50%;
border: 1px solid #000;
}
.header-content {
text-align: center;
display: block;
}
.header-content h1 {
text-transform: uppercase;
font-weight: bolder;
letter-spacing: 2px;
font-size: 7vw;
margin-top: 54px;
}
.header-content h3 {
font-size: 3vw;
font-weight: 300;
line-height: 2em;
}
.header,
.menu {
padding: 48px 0;
}
a {
text-decoration: none;
}
ul {
list-style: none;
}
li {
display: inline-block;
position: relative;
}
.header-content ul li {
display: inline-block;
position: relative;
width: 43px;
}
.header-content ul li a {
display: inline-block;
width: 36px;
height: 36px;
background: #81b09b;
text-align: center;
line-height: 36px;
border-radius: 50%;
border: 0.4px solid #383231;
transition: all 0.35s;
cursor: pointer;
}
.fa {
color: #fff;
transition: all 0.35s;
}
.fa:hover {
color: #383231;
transition: all 0.50s;
}
.menu {
text-align: center;
}
.menu a {
color: #454545;
}
nav li {
display: inline-block;
padding: 0 5px;
}
nav a {
text-align: center;
font-size: 18px;
}
nav img {
width: 170px;
height: 170px;
}
nav span {
display: block;
cursor: pointer;
}
hr {
padding: 0;
margin: 0;
}
.footer {
width: 100%;
padding: 17px;
}
.footer div {
text-align: center;
margin-bottom: 1rem;
}
.footer div:last-child {
margin-bottom: 0;
}
.footer a {
font-size: 18px;
}
.footer span {
width: 36px;
height: 36px;
border-radius: 50%;
background: #81b09b;
display: inline-block;
text-align: center;
line-height: 36px;
margin-right: 10px;
cursor: pointer;
transition: all 0.35s;
}
.footer .create-by {
width: 100%;
background: none;
height: 100%;
font-size: 18px;
letter-spacing: 2px;
color: #454545;
font-weight: 100;
display: inline-block;
text-align: center;
}
/*Small CSS*/
@media only screen and (min-width: 48em) {
.header-content h1 {
font-size: 6vw;
}
.header-content h3 {
font-size: 2.5vw;
}
.menu {
text-align: center;
}
.footer div {
text-align: left;
margin: 0;
}
.footer div:nth-child(1),
.footer div:nth-child(2) {
margin-bottom: 1em;
}
.footer .create-by {
text-align: left;
}
}
/*Midium CSS*/
@media only screen and (min-width: 62em) {
.main-container {
max-width: 70em;
width: 100%;
position: relative;
margin: 2em auto;
background: #fff;
}
.header-img {
text-align: right;
}
.header-content {
text-align: left;
display: block;
}
.header-content h1 {
font-size: 4vw;
}
.header-content h3 {
font-size: 2vw;
font-weight: 300;
}
.footer div {
text-align: left;
margin: 0 !important;
}
.footer a {
font-size: 18px;
}
.footer .create-by {
text-align: right;
}
}
<link href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css" rel="stylesheet"/>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/flexboxgrid/6.3.1/flexboxgrid.min.css" type="text/css" >
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="main-container">
<div class="container-fluid header">
<div class="row">
<div class="col-md-5 col-xs-12 header-img">
<img src="https://image.ibb.co/cwot07/profile_gif.png" alt="profile-img">
</div>
<div class="col-md-7 col-xs-12 header-content">
<h1>Amit Sharma</h1>
<h3>Web Designer & Mobile Application Developer</h3>
<ul>
<li>
<a href="#" class="icon icon-fa cebook">
<i class="fa fa-facebook"></i>
</a>
</li>
<li>
<a href="#" class="icon icon-twitter">
<i class="fa fa-twitter"></i>
</a>
</li>
<li>
<a href="#" class="icon icon-googlePlus">
<i class="fa fa-google"></i>
</a>
</li>
<li>
<a href="#" class="icon icon-youtube">
<i class="fa fa-youtube"></i>
</a>
</li>
</ul>
</div>
</div>
</div>
<hr>
<div class="menu">
<div class="row">
<div class="col-md-12">
<nav>
<ul>
<li>
<a href="#" class="menu">
<img id="profile" src="https://image.ibb.co/cwot07/profile_gif.png" alt="profile-img">
<span>Profile</span>
</a>
</li>
<li>
<a href="#" class="menu">
<img id="resume" class="resume" src="https://image.ibb.co/dwKNtS/resume_01.png" alt="img">
<span>Resume</span>
</a>
</li>
<li>
<a href="#" class="menu">
<img id="port" class="portfolio" src="https://image.ibb.co/m5Ot07/port_01.png" alt="img">
<span>Portfolio</span>
</a>
</li>
<li>
<a href="#" class="menu">
<img id="contact" class="contact" src="https://image.ibb.co/bFUu7n/contact_01.png" alt="img">
<span>Contact</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<hr>
<div class="footer">
<div class="row">
<div class="col-md-3 col-sm-6 col-xs-12">
<a class="contact-no">
<span><i class="fa fa-phone"></i></span>+919871344356
</a>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<a class="mail">
<span><i class="fa fa-paper-plane"></i></span>amitmeet28@yahoo.in
</a>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<a class="address">
<span><i class="fa fa-map-marker"></i></span>Rz New T 19 uttam nagar
</a>
</div>
<div class="col-md-3 col-sm-6 col-xs-12">
<span class="create-by">Create by Amit Sharma</span>
</div>
</div>
</div>
</div>
在小型媒体查询菜单栏中没有设置在中心,但它在中型或超小型媒体查询中工作我尝试所有可能的解决方案。但没有奏效。在小型媒体查询菜单栏中没有设置在中心,但它在中型或超小型媒体查询中工作我尝试所有可能的解决方案。但没有奏效。
答案
只需添加CSS的CSS端
<code>@media only screen and(max-width:768px) {
nav ul {
width: 85%;
text-align: center;
display: flex;
align-items: center;
}
nav ul li {
padding:0;
width:25%;
}
nav ul li img {
width:70%
}
}</code>
另一答案
@media only screen and (min-width: 48em) {
.menu-bar {
display: flex;
justify-content: center;
text-align: center;
}
}
以上是关于在小型媒体查询菜单中没有设置它在中等或Xtra小中的工作的主要内容,如果未能解决你的问题,请参考以下文章
Iperius Backup Full--小中企业简单自动备份的实用工具
在 JavaScript 中使用媒体查询或在 CSS 中使用 if/else 语句