I `want to make several 'blocks' of text go from this:
|1| |2| |3| |4| |5| |6|
When viewed on a screen wider than a tablet, to be responsive according to the smaller screen size, like this:
On tablet:
| 1 | | 2 | | 3 |
| 4 | | 5 | | 6 |
On mobile:
|1|
|2|
|3|
|4|
|5|
|6|
Here is the weblink to the page:
create.qublu.com/rates
The full width of the page is 980px. What I need is for each div to have a responsive width according to the screen size viewed and to be centered on the screen.
As you will see on the page, there are four toggle buttons. Level 1, Level 2, Level 3 and Level 4. Level 2 works absolutely fine and perfect. But all the blocks on Level 1 just aren't lining up when viewed on large screens. Instead, the blocks are displaying 3 blocks x 2 rows. Very frustrating!
This is the CSS code I am using:
.col-xs-1,
.col-sm-1,
.col-md-1,
.col-lg-1 {
position: relative;
min-height: 1px;
padding-right: 0px;
padding-left: 0px;
}
.col-xs-1 {
width: 8.33%;
float: left;
}
#media (min-width: 321px) {
.col-sm-1 {
width: 8.33%;
float: left;
}
}
#media (min-width: 699px) {
.col-md-1 {
width: 8.33%;
float: left;
}
}
#media (min-width: 979px) {
.col-lg-1 {
width: 8.33%;
float: left;
}
}
.col-xs-2,
.col-sm-2,
.col-md-2,
.col-lg-2 {
position: relative;
min-height: 1px;
padding-right: 0px;
padding-left: 0px;
}
.col-xs-2 {
width: 16.66%;
float: left;
}
#media (min-width: 321px) {
.col-sm-2 {
width: 16.66%;
float: left;
}
}
#media (min-width: 699px) {
.col-md-2 {
width: 16.66%;
float: left;
}
}
#media (min-width: 979px) {
.col-lg-2 {
width: 16.66%;
float: left;
}
}
.col-xs-3,
.col-sm-3,
.col-md-3,
.col-lg-3 {
position: relative;
min-height: 1px;
padding-right: 0px;
padding-left: 0px;
}
.col-xs-3 {
width: 25%;
float: left;
}
#media (min-width: 321px) {
.col-sm-3 {
width: 25%;
float: left;
}
}
#media (min-width: 699px) {
.col-md-3 {
width: 25%;
float: left;
}
}
#media (min-width: 979px) {
.col-lg-3 {
width: 25%;
float: left;
}
}
.col-xs-4,
.col-sm-4,
.col-md-4,
.col-lg-4 {
position: relative;
min-height: 1px;
padding-right: 0px;
padding-left: 0px;
}
.col-xs-4 {
width: 33.33%;
float: left;
}
#media (min-width: 321px) {
.col-sm-4 {
width: 33.33%;
float: left;
}
}
#media (min-width: 699px) {
.col-md-4 {
width: 33.33%;
float: left;
}
}
#media (min-width: 979px) {
.col-lg-4 {
width: 33.33%;
float: left;
}
}
.col-xs-5,
.col-sm-5,
.col-md-5,
.col-lg-5 {
position: relative;
min-height: 1px;
padding-right: 0px;
padding-left: 0px;
}
.col-xs-5 {
width: 41.66%;
float: left;
}
#media (min-width: 321px) {
.col-sm-5 {
width: 41.66%;
float: left;
}
}
#media (min-width: 699px) {
.col-md-5 {
width: 41.66%;
float: left;
}
}
#media (min-width: 979px) {
.col-lg-5 {
width: 41.66%;
float: left;
}
}
.col-xs-6,
.col-sm-6,
.col-md-6,
.col-lg-6 {
position: relative;
min-height: 1px;
padding-right: 0px;
padding-left: 0px;
}
.col-xs-6 {
width: 50%;
float: left;
}
#media (min-width: 321px) {
.col-sm-6 {
width: 50%;
float: left;
}
}
#media (min-width: 699px) {
.col-md-6 {
width: 50%;
float: left;
}
}
#media (min-width: 979px) {
.col-lg-6 {
width: 50%;
float: left;
}
}
.col-xs-7,
.col-sm-7,
.col-md-7,
.col-lg-7 {
position: relative;
min-height: 1px;
padding-right: 0px;
padding-left: 0px;
}
.col-xs-7 {
width: 58.47%;
float: left;
}
#media (min-width: 321px) {
.col-sm-7 {
width: 58.47%;
float: left;
}
}
#media (min-width: 699px) {
.col-md-7 {
width: 58.47%;
float: left;
}
}
#media (min-width: 979px) {
.col-lg-7 {
width: 58.47%;
float: left;
}
}
.col-xs-8,
.col-sm-8,
.col-md-8,
.col-lg-8 {
position: relative;
min-height: 1px;
padding-right: 0px;
padding-left: 0px;
}
.col-xs-8 {
width: 66.66%;
float: left;
}
#media (min-width: 321px) {
.col-sm-8 {
width: 66.66%;
float: left;
}
}
#media (min-width: 699px) {
.col-md-8 {
width: 66.66%;
float: left;
}
}
#media (min-width: 979px) {
.col-lg-8 {
width: 66.66%;
float: left;
}
}
.col-xs-9,
.col-sm-9,
.col-md-9,
.col-lg-9 {
position: relative;
min-height: 1px;
padding-right: 0px;
padding-left: 0px;
}
.col-xs-9 {
width: 75%;
float: left;
}
#media (min-width: 321px) {
.col-sm-9 {
width: 75%;
float: left;
}
}
#media (min-width: 699px) {
.col-md-9 {
width: 75%;
float: left;
}
}
#media (min-width: 979px) {
.col-lg-9 {
width: 75%;
float: left;
}
}
.col-xs-10,
.col-sm-10,
.col-md-10,
.col-lg-10 {
position: relative;
min-height: 1px;
padding-right: 0px;
padding-left: 0px;
}
.col-xs-10 {
width: 83.33%;
float: left;
}
#media (min-width: 321px) {
.col-sm-10 {
width: 83.33%;
float: left;
}
}
#media (min-width: 699px) {
.col-md-10 {
width: 83.33%;
float: left;
}
}
#media (min-width: 979px) {
.col-lg-10 {
width: 83.33%;
float: left;
}
}
.col-xs-11,
.col-sm-11,
.col-md-11,
.col-lg-11 {
position: relative;
min-height: 1px;
padding-right: 0px;
padding-left: 0px;
}
.col-xs-11 {
width: 91.74%;
float: left;
}
#media (min-width: 321px) {
.col-sm-11 {
width: 91.74%;
float: left;
}
}
#media (min-width: 699px) {
.col-md-11 {
width: 91.74%;
float: left;
}
}
#media (min-width: 979px) {
.col-lg-11 {
width: 91.74%;
float: left;
}
}
.col-xs-12,
.col-sm-12,
.col-md-12,
.col-lg-12 {
position: relative;
min-height: 1px;
padding-right: 0px;
padding-left: 0px;
}
.col-xs-12 {
width: 99%;
float: left;
}
#media (min-width: 321px) {
.col-sm-12 {
width: 99%;
float: left;
}
}
#media (min-width: 699px) {
.col-md-12 {
width: 99%;
float: left;
}
}
#media (min-width: 979px) {
.col-lg-12 {
width: 99%;
float: left;
}
}
.col-xs-15,
.col-sm-15,
.col-md-15,
.col-lg-15 {
position: relative;
min-height: 1px;
padding-right: 0px;
padding-left: 0px;
}
.col-xs-15 {
width: 20%;
float: left;
}
#media (min-width: 321px) {
.col-sm-15 {
width: 20%;
float: left;
}
}
#media (min-width: 699px) {
.col-md-15 {
width: 20%;
float: left;
}
}
#media (min-width: 979px) {
.col-lg-15 {
width: 20%;
float: left;
}
}
Have a look here:
http://www.w3schools.com/bootstrap/bootstrap_grid_system.asp
To have 6 columns in one row you can use col-XX-2 - where XX is the screen size abbreviation
In your example "col-md-2" used as class for your level-1 divs will result in:
|1| |2| |3| |4| |5| |6|
Related
https://blendbee.com
This is a WordPress site. The top part of the header needs some styling improvements for smaller screen sizes:
Center the logo
Some padding or margin above the logo (so it doesn't touch the top bar)
Less whitespace above and below the menu icon
Here's the current HTML code:
<div class="header-wrap">
<header id="header" class="site-header " role="banner">
<div class="row">
<div class="large-12 small-12 columns">
<div class="logo">
<a href="https://blendbee.com/" title="BlendBee – Your Tea. Your Way." rel="home">
<img data-interchange="[https://blendbee.com/wp-content/uploads/2014/06/BlendBee-Logo-and-Tagline-2.png, (default)], [https://blendbee.com/wp-content/uploads/2014/06/BlendBee-Logo-and-Tagline-2.png, (retina)]" alt="" class="hideie" data-uuid="60a3bc00-c94c-c4ba-258c-a9faa107e418" src="https://blendbee.com/wp-content/uploads/2014/06/BlendBee-Logo-and-Tagline-2.png">
<img src="https://blendbee.com/wp-content/uploads/2014/06/BlendBee-Logo-and-Tagline-2.png" alt="" class="ie">
<noscript><img src='https://blendbee.com/wp-content/uploads/2014/06/BlendBee-Logo-and-Tagline-2.png' alt='BlendBee – Your Tea. Your Way.'></noscript>
</a>
</div>
<div id="mobile-menu-button" class="show-for-small">
<a class="secondary button" id="mobileMenuButton" href="#mobile-menu">
<span class="mobile-menu-icon"></span>
<span class="mobile-menu-icon"></span>
<span class="mobile-menu-icon"></span>
</a>
</div>
</div>
</div>
</header>
</div>
And related CSS:
#media screen and (max-width: 767px) {
.mix.half.mix_all {
width: 50%;
float: left;
}
.mix.mix_all {
width: 100%;
}
.sidebar.large-3.small-12.columns {
width: 100%;
float: none;
}
#soc-icons-wrap.closed {
margin-bottom: 20px;
height: 50px;
}
.large-6.small-12.columns p{
width: 100% !important;
}
#header.scroll-to-fixed {
position: static;
}
}
#mobile-menu-button .button {
margin-bottom: 0;
padding: 0.75em 0.5em;
width: auto
}
.mobile-menu-icon {
background: #fff;
height: 0.25em;
width: 2.5em;
display: block;
}
.mobile-menu-icon + .mobile-menu-icon {
margin: 0.25em 0 0
}
#media only screen and (min-width: 767px) {
body.admin-bar #header.scroll-to-fixed {
top: 32px;
}
}
#media only screen and (max-width: 767px) {
.logo {
float: none;
text-align: center;
}
#header.scroll-to-fixed {
position: static !important;
height: auto;
width: auto;
border-bottom: none;
}
#header.scroll-to-fixed .logo {
width: 300px;
padding-top: 20px;
position: static;
top: 0;
margin: 0 auto;
}
#header.scroll-to-fixed .logo img {
max-height: 140px;
width: 100%;
-webkit-transition: none;
-moz-transition: none;
transition: none;
}
#mobile-menu .tiled-menu {
float: none;
margin: 0;
padding: 0;
}
#mobile-menu .main-menu-item {
float: none;
width: 100% !important;
}
#mobile-menu .menu-tile {
height: 60px !important;
background-image: none !important;
}
#mobile-menu .item-title,
#mobile-menu .tiled-menu > .menu-item-language > a {
top: 5px;
font-size: 20px;
left: 25px;
}
#mobile-menu .tile-icon,
#mobile-menu .tiled-menu > .menu-item-language:before {
right: 10%;
width: auto;
}
#mobile-menu .tiled-menu > .menu-item-language {
height: 60px !important;
}
#mobile-menu .style-metro .sub-menu {
padding-top: 3px;
}
}
#media only screen and (min-width: 640px) and (max-width: 1024px) {
.tiled-menu .sub-menu {
position: absolute;
}
.tiled-menu {
text-align: center;
}
.main-menu-item {
text-align: left;
}
.tiled-menu .metro-menu-item .sub-menu {
position: absolute;
}
}
wrapper i {
margin: 84px 0 0 110px;
}
.entry-header .entry-meta .entry-tags {
margin-left: 0;
}
.large-12.small-12.columns .large-8.small-12.columns .large-6.small-12.columns {
position: relative;
top: 12px;
}
.large-12.small-12.columns .large-8.small-12.columns .large-3.small-12.columns .answer {
width: 33%;
margin-top: 20px;
}
.large-12.small-12.columns .large-8.small-12.columns .large-3.small-12.columns .answer input {
padding: 18px 5px;
}
.large-12.small-12.columns .large-8.small-12.columns .large-3.small-12.columns {
width: 13%;
margin-top: 20px;
}
.large-12.small-12.columns .large-8.small-12.columns .large-3.small-12.columns.answer{
width: 33%;
margin-top: 20px;
}
.site-header {
border-bottom: none;
}
ol ul, ul ol, ul ul, ol ol {
-webkit-margin-before: 0px;
-webkit-margin-after: 10px;
}
.large-12.small-12.columns .large-8.small-12.columns .large-6.small-12.columns p {
float: left;
width: 70%;
text-align: left;
margin-top: 0;
}
#media only screen and (min-width: 320px) and (max-width: 767px) {
.tiled-menu {
left: -3px !important;
}
.tiled-menu>li>ul {
padding-top: 0;
}
}
#media screen and (max-width: 320px) {
.large-12.small-12.columns .large-8.small-12.columns .large-6.small-12.columns{
text-align: center;
}
.large-12.small-12.columns .large-8.small-12.columns .large-3.small-12.columns{
margin-left: 28%;
margin-top: 0;
width: 52%;
}
.large-12.small-12.columns .large-8.small-12.columns .large-3.small-12.columns.answer{
margin-top:0 ;
}
.large-3.small-12.columns input{
width: 145px;
}
}
#media screen and (min-width: 321px) and (max-width: 480px) {
.large-12.small-12.columns .large-8.small-12.columns .large-6.small-12.columns{
text-align: center;
}
.large-12.small-12.columns .large-8.small-12.columns .large-6.small-12.columns{
text-align: center;
}
.large-12.small-12.columns .large-8.small-12.columns .large-3.small-12.columns{
margin-left: 36%;
margin-top: 0;
width: 35%;
}
.large-12.small-12.columns .large-8.small-12.columns .large-3.small-12.columns.answer{
margin-top:0 ;
}
.large-3.small-12.columns input{
width: 148px;
}
}
#media screen and (min-width: 480px) and (max-width: 800px) {
.site-header .logo {
margin: 0 auto 20px;
}
.site-header.scroll-to-fixed .logo {
margin: 0;
}
}
#media screen and (min-width: 481px) and (max-width: 568px) {
.large-12.small-12.columns .large-8.small-12.columns .large-6.small-12.columns{
text-align: center;
}
.large-12.small-12.columns .large-8.small-12.columns .large-3.small-12.columns{
margin-left: 38%;
margin-top: 0;
width: 30%;
}
.large-12.small-12.columns .large-8.small-12.columns .large-3.small-12.columns.answer{
margin-top:0 ;
}
.large-3.small-12.columns input{
width: 149px;
}
}
#media screen and (min-width: 569px) and (max-width: 600px) {
.category-submenu .sub-nav .sub-nav dd {
margin-left: 0.8rem !important;
margin-bottom: 0;
}
.mix .entry-thumbnail img {
width: 100% !important;
}
.large-12.small-12.columns .large-8.small-12.columns .large-6.small-12.columns{
text-align: center;
}
.large-12.small-12.columns .large-8.small-12.columns .large-3.small-12.columns{
margin-left: 38%;
margin-top: 0;
width: 28%;
}
.large-12.small-12.columns .large-8.small-12.columns .large-3.small-12.columns.answer{
margin-top:0 ;
}
.large-3.small-12.columns input{
width: 148px;
}
.pricetable-column {width: 50% !important;}
}
#media screen and (min-width: 768px) and (max-width: 800px) {
.large-12.small-12.columns .large-8.small-12.columns .large-6.small-12.columns p{
float: left;
width: 56%;
text-align: left;
margin-top: 0;
}
.large-12.small-12.columns .large-8.small-12.columns .large-3.small-12.columns {
width: 13%;
margin-top: 20px;
}
.large-12.small-12.columns .large-8.small-12.columns .large-3.small-12.columns.answer{
width: 26%;
margin-top: 20px;
}
}
#media screen and (min-width: 768px) and (max-width: 1000px) {
.logo {
float: none;
margin: 0 auto;
}
#header.scroll-to-fixed .logo {
display: none;
}
.main-menu-item {
display: inline-block;
margin-left: 0;
float: none;
text-align: left;}
.tiled-menu {
float: none;
text-align: center;
}
}
#media screen and (min-width: 640px) and (max-width: 767px) {
.tiled-menu>li>ul {
padding-top: 25px;
}
}
If anyone can help, I'd be much appreciative - thanks :)
First - Try using this code for centering your logo and adding some padding to the top:
.logo {
padding-top: 50px;
width: 280px;
margin: auto;
}
Enter this code in the "Custom CSS" part when you open your customizer.
Second - This code for removing some white space below your menu icon:
#mobile-menu-button {float: none;text-align: center;}
Replace this part in the responsive.min.css file.
Third - This code for removing some white space above your menu icon:
#mobile-menu-button {
margin: 1rem 0 0;
}
Replace this part in the foundation.css file.
As you will see, it works:
i want to implement following styles for 900 to 1023px
.navbar-brand {
float: left;
margin-right: 5px;
margin-left: -15px
}
.navbar-nav {
float: left;
margin-top: 0;
margin-bottom: 0
}
.navbar-nav>li {
float: left
}
.navbar-nav>li>a {
border-radius: 0
}
.navbar-nav.pull-right {
float: right;
width: auto;
margin:10px 0 ;
}
.navbar-toggle {
position: relative;
top: auto;
left: auto;
display: none
}
.nav-collapse.collapse {
display: block!important;
height: auto!important;
overflow: visible!important
}
i applied following media query
#media screen (min-width: 900px) and (max-width: 1024px) {
// here goes above code
}
but problem is that these stlyes are being applied on 1300 + resolution as well . whats wrong with it please help
You miss and after #media screen
#media screen and (min-width: 900px) and (max-width: 1024px) {
// here goes above code
}
I'm using Prepros to compile my SCSS files to CSS, but it gives me an error when i try to use media queries. I tried Coala and Scout as well.
If i just copy this code into output CSS it works.
What am i doing wrong?
#media only screen and (max-width: 320px) {
body {
width: 320px;
}
.wrapper {
width: 320px;
margin: 0 auto;
}
.works-wrap {
width: 320px;
}
}
#media only screen and (min-width: 320px) and (max-width: 610px) {
.wrapper {
width: 320px;
margin: 0 auto;
}
.works-wrap {
width: 320px;
}
}
#media only screen and (min-width: 610px) and (max-width: 950px) {
.wrapper {
width: 650px;
margin: 4% auto;
}
.name {
width: 100%;
}
.works-wrap {
width: 650px;
margin-left: 10px;
}
}
#media only screen and (min-width: 950px) and (max-width: 1024px) {
.wrapper {
width: 950px;
margin: 4% auto;
}
.name {
width: 100%;
}
.works-wrap {
width: 950px;
}
}
Error code:
Error: Invalid CSS after "": expected selector, was "#media only scr..."
on line 169 of style.scss
164: width: 650px;
165: margin-left: 10px;
166: }
167: }
168:
169: #media only screen and (min-width: 950px) and (max-width: 1024px) {
170: .wrapper {
171: width: 950px;
172: margin: 4% auto;
173: }
174: .name {
Backtrace:
style.scss:169
c:/Program Files (x86)/Prepros/resources/app/ruby/ruby_gems/gems/sass-3.4.9/lib/sass/scss/parser.rb:1165:in `expected'
Try this it is a copy/paste mistake
#media only screen and (max-width: 320px) {
body {
width: 320px;
}
.wrapper {
width: 320px;
margin: 0 auto;
}
.works-wrap {
width: 320px;
}
}
#media only screen and (min-width: 320px) and (max-width: 610px) {
.wrapper {
width: 320px;
margin: 0 auto;
}
.works-wrap {
width: 320px;
}
}
#media only screen and (min-width: 610px) and (max-width: 950px) {
.wrapper {
width: 650px;
margin: 4% auto;
}
.name {
width: 100%;
}
.works-wrap {
width: 650px;
margin-left: 10px;
}
}
#media only screen and (min-width: 950px) and (max-width: 1024px) {
.wrapper {
width: 950px;
margin: 4% auto;
}
.name {
width: 100%;
}
.works-wrap {
width: 950px;
}
}
There is a hidden char just after the closing bracket of #media only screen and (min-width: 610px) and (max-width: 950px) just delete it
I have a media query written but it breaks at certain point, I am now trying to optimize the query to the following :
#media only screen and (max-width: 1366px) and (min-width: 1280px) {
}
#media only screen and (max-width: 1280px) and (min-width: 1024px) {
}
#media only screen and (max-width: 1024px) and (min-width: 768px) {
}
#media only screen and (max-width: 768px) and (min-width: 640px) {
}
#media only screen and (max-width: 640px) and (min-width: 320px) {
}
Here is the one which i am using now
#media only screen and (max-width: 1366px) {
.menuTemplate3
{
margin-top: 3%;
}
.menuTemplate3 a
{
padding: 0 30px;
}
.wrap{
width:95%;
}
.span_of_2 {
padding: 3% 0;
margin: 4% 0;
}
.menu li {
margin: 6px 16px;
}
}
#media only screen and (max-width: 1280px) {
.menuTemplate3
{
margin-top: 3% !important;
}
.menuTemplate3 a
{
padding: 0 25px !important;
}
.wrap{
width:95%;
}
.menu li {
margin: 6px 12px;
}
.booking_room h4 {
font-size: 1.2em;
}
.booking_room p {
font-size: 0.8125em;
}
.f_nav li {
margin-left: 10px;
}
}
#media only screen and (max-width: 1024px) {
.menuTemplate3
{
margin-top: 3% !important;
}
.menuTemplate3 a
{
padding: 0 17px !important;
}
.wrap{
width:95%;
}
.menu li {
margin: 10px 8px;
}
.menu li a {
font-size: 0.8725em;
}
.reservation ul li.span1_of_3 {
width: 14.33333%;
margin-left: 15px;
}
.f_nav li a {
padding: 0 0px;
}
.grid1_of_3 {
float: left;
width: 100% !important;
margin-left: 0%;
}
}
#media only screen and (max-width: 768px) {
.menuTemplate3
{
margin-top: -3% !important;
}
.menuTemplate3 a
{
padding: 0 9px !important;
}
.wrap{
width:95%;
}
.row .grid_3 {
float: right;
width: 38.333333% !important;
}
.menu {
display: none;
}
.logo img
{ margin-left: -14% !important; }
.h_right {
width: 100%;
float: none;
}
.row {
width: 70% !important;
}
.top-nav {
display: block;
margin: 10px 0;
z-index: 999;
position: relative;
}
.nav a{
display: block;
}
.reservation ul li {
float: none;
display: inline-block;
}
.booking_room {
float: none;
width: 98%;
}
.reservation {
float: none;
width: 98%;
}
.b_room {
display: inline-block;
}
.grid1_of_3 h4 a {
font-size: 1.4em;
}
.copy {
float: none;
text-align:center;
}
.f_nav {
float: none;
text-align:center;
margin-top: 20px;
}
.soc_icons {
text-align: center;
margin: 20px 0;
}
.content {
float: none;
width: 100%;
margin-right: 0%;
}
.sidebar {
float: none;
width: 100%;
padding-left: 0%;
border-left: none;
}
.sidebar h4 {
margin: 4% 0 4%;
}
.sel_room {
float: none;
width: 100%;
}
.sel_room.left {
margin-left: 0%;
}
.service_list li {
width: 48.3333%;
margin-bottom:4%;
}
.service_list li:nth-child(3){
margin-left: 0;
}
.reservation h5 {
margin: 10px 0;
}
}
#media only screen and (max-width: 640px){
.menuTemplate3
{
margin-top: 3% !important;
}
.menuTemplate3 a
{
padding: 0 8px;
}
.wrap{
width:95%;
}
.logo{
width: 20%;
}
.h_right{
width:100%;
}
.row .grid_3 {
width: 70.333333% !important;
}
.reservation ul li.span1_of_1 {
width: 100%;
}
.row .grid_3 {
width: 70.333333% !important;
}
.book_date input[type="text"] {
width: 96% !important;
}
.reservation ul li.left {
margin-left: 0px;
}
.reservation ul li.span1_of_2 {
width: 49.33333%;
}
.reservation ul li.span1_of_3 {
width: 47.33333%;
margin-left: 10px;
}
.grid1_of_3 {
float: left;
width: 100%;
margin-left: 0%;
}
.grid1_of_3 h4 a {
margin: 2% 0;
}
.grid1_of_3 img{
margin-top:4%;
width: 10%;
}
.online_reservation {
margin-top: -30px;
}
.reservation ul li.span1_of_2 {
width: 48.33333%;
}
.res_btn form input[type="submit"] {
width: 50% !important;
padding: 10px;
}
.contact_left {
float: none;
margin-right: 0%;
width: 100%;
}
.contact_right {
float: none;
width: 100%;
}
.logo img{
margin-left: 0%;
margin-top: 2%;
}
}
#media only screen and (max-width: 530px) {
.menuTemplate3
{
margin-top: -11%;
width: 70%;
}
.menuTemplate3 a
{
padding: 0 15px;
}
.wrap{
width:95%;
}
.logo{
width: 32.333333%;
}
.h_right{
width:60.333333%;
}
.row .grid_3 {
width: 70.333333% !important;
}
.online_reservation {
margin-top: 0px;
}
.date_btn {
margin: 0 0 20px;
}
.logo img{
margin-left: 0%;
margin-top: 2%;
}
}
#media only screen and (max-width: 320px) {
.menuTemplate3
{
margin-top: -11%;
width: 70%;
}
.menuTemplate3 a
{
padding: 0 15px;
}
.wrap{
width:95%;
}
.logo{
width: 38.333333%;
}
.h_right{
width:60.333333%;
}
.row .grid_3 {
width: 70.333333% !important;
}
.reservation {
padding: 10px;
width: 97%;
}
.booking_room {
width: 97%;
padding: 10px;
}
.hide{
display: none;
}
.reservation ul li.span1_of_2 {
width: 100%;
}
.reservation ul li.span1_of_3 {
width: 100%;
margin-left: 0px;
}
.book_date input[type="text"] {
width: 93% !important;
}
.soc_icons ul li {
margin-left: 0px;
}
.grids_of_img {
float: none;
width: 100%;
}
.grids_of_para {
float: none;
width: 100%;
margin-left: 0%;
}
.span2_of_1 {
float: none;
width: 100%;
margin-left: 0%;
}
.res_btn form input[type="submit"] {
width: 60% !important;
padding: 10px;
}
.service_list li {
float:none;
margin-left:0;
width: 100%;
margin-bottom: 4%;
}
.contact-form input[type="text"], .contact-form textarea {
width: 93% !important;
}
.contact-form input[type="submit"] {
padding: 10px;
width: 50% !important;
}
.logo img{
margin-left: 0%;
margin-top: 2%;
}
}
Can anybody help me with the use the optimized media query? I am confused to place the classes.
you should use max-width and min-width both for media query like this is example
You'll want to use both min and max widths to optimize:
#media (min-width: 1281px) and (max-width: 1366px) {
}
#media (min-width: 1025px) and (max-width: 1280px) {
}
#media (min-width: 769px) and (max-width: 1024px) {
}
#media (min-width: 641px) and (max-width: 768px) {
}
#media (min-width: 321px) and (max-width: 640px){
}
#media (min-width: 1px) and (max-width: 320px) {
}
I have a couple media queries in my stylesheet, each modifying some styles, but not others. I'm using the max-width query:
#media screen and (max-width: 1024px) {
#header .span6 { width: 60%; margin-left: 200px; }
#error .span6 { width: 60%; margin-left: 200px; }
#timer-block { width: 60%; margin-left: 200px;}
#timer { font-size: 5em; }
#start-pause { margin-left: 200px; }
.control { width: 297px; margin-top: 0; }
#footer { width: 60%; margin-left: 200px; }
}
#media screen and (max-width: 768px) {
#header .span6 { width: 80%; margin-left: 75px; }
#error .span6 { width: 80; margin-left: 75px; }
#timer-block { width: 80%; margin-left: 75px;}
#timer { font-size: 5em; }
#start-pause { margin-left: 75px; }
.control { width: 300px; margin-top: -5px; }
#footer { width: 80%; margin-left: 75px; }
}
#media screen and (max-width: 800px) {
#header .span6 { width: 80%; margin-left: 75px; }
h1 { font-size: 3.5em; margin-bottom: 0px;}
#error .span6 { width: 80%; margin-left: 75px; }
#timer-block { width: 80%; margin-left: 75px; }
#timer { font-size: 5em; }
.little { font-size: 0.5em; }
#start-pause { margin-left: 75px; }
.control { width: 312px; margin-top: -5px; }
#footer { width: 80%; margin-left: 75px; }
}
#media screen and (max-width: 600px) {
#header .span6 { width: 90%; margin-left: 25px; }
#error .span6 { width: 90%; margin-left: 30px; }
#timer-block { width: 90%; margin-left: 30px;}
#start-pause { margin-left: 30px; }
.control { width: 264px; margin-top: -5px; }
#footer { width: 90%; margin-left: 25px; }
}
#media screen and (max-width: 480px) {
#header { margin-top: -10px; }
#header .span6 { width: 90%; margin-left: 25px; }
h1 { font-size: 3em; margin-left: -15px; padding-left: 10px; }
#interval { width: 150px; height: 40px; font-size: 2em; margin-bottom: 20px; width: 150px; }
#error .span6 { width: 90%; margin-left: 25px; }
#timer-block { width: 90%; margin-left: 24px; height: 100px; padding: 10px; }
#start-pause { margin-left: 25px; }
.control { margin-top: -5px; width: 210px; }
#footer { width: 100%; margin-top: -20px; margin-left: 0; }
}
#media screen and (max-width: 320px) {
#timer-block { width: 90%; margin-left: 15px; padding: 10px; font-size: 0.8em; }
#header { margin-top: 0px; }
#header .span6 { margin-left: 37px; }
#interval { margin-top: -45px; margin-left: 20px; }
#error .span6 { width: 90%; margin-left: 15px; }
.control { width: 141px; margin-top: -10px; }
#start-pause { margin-left: 15px; }
#footer { width: 95%; margin-left: 10px; }
}
Is there a way I can change what I'm doing to make there be no collisions? This is the first time I use media queries so I may be missing something entirely.
Instead of
#media screen and (max-width: 480px)
You can use
#media screen and (max-width: 480px) and (min-width: 321px)
This way it will look only at screen sizes between 320 and 481;
instead of 0 and 481
Set a min width 1 pixel higher than the max width of the next query
Example
#media screen and (min-width: 769px) and (max-width: 1024px) {
#header .span6 { width: 60%; margin-left: 200px; }
#error .span6 { width: 60%; margin-left: 200px; }
#timer-block { width: 60%; margin-left: 200px;}
#timer { font-size: 5em; }
#start-pause { margin-left: 200px; }
.control { width: 297px; margin-top: 0; }
#footer { width: 60%; margin-left: 200px; }
}
I think you need to use min-width in this case to prevent collision, for example:
#media only screen and (min-width : 321px) and (max-width : 480px) {
/* Styles */
}