I am stucked with the resolution.
I am writing CSS for the following resolutions.
a. 800x600
b. 1024x768
c. 1280x800 and 1280x1024
d. 1366x768
e. 1920x1080
f. 2560x1440
And my laptop resolution is 1366*768, I have done CSS queries till there, but the problem arising now is how I write CSS for 1920*1080 and 2560*1440
I am testing the resolutions by changing the inspect element of chrome.
I have tried to code for 1920*1080, but it is only working if I am removing the code of 1366*768, means at a time only one code is running.
Here is my code of CSS:
#media only screen and (max-device-width: 800px) and (max-device-height: 600px){
.tab-menu
{
padding: 0px;
width: 16.2%;
margin-right: 1px !important;
}
.tab-menu a
{
font-size: 13px !important;
}
.main
{
width: 10%;
}
.other
{
width: 10%;
}
.sku
{
width: 10%;
}
.adjust-height
{
width: 100px;
}
.table
{
font-size: 13px;
}
.w-line
{
width : 9.2%;
}
.w-store
{
width: 9%;
}
.w-item{
width: 13.3%;
}
.w-item-name{
width:22.4%;
}
.w-qty
{
width: 10%;
}
.w-uom
{
width: 5%;
}
.w-price
{
width: 10%;
}
.w-total
{
width: 1.4%;
}
.w-blank
{
width: 2%;
}
}
#media all and (-ms-high-contrast:none) and (max-device-width: 800px) and (max-device-height: 600px) {
*::-ms-backdrop,.w-line {
width: 9%;
}
*::-ms-backdrop,.w-qty {
width: 9%;
}
*::-ms-backdrop,.w-price {
width: 10%;
}
}
#media only screen and (max-device-width: 1280px) and (max-device-height: 720px){
.bottom-grid
{
height: 130px;
}
.adjust-height
{
width: 130px;
}
#-moz-document url-prefix() {
.bottom-grid
{
height: 120px;
}
}
*::-ms-backdrop,.bottom-grid {
height: 121px;
}
}
#media only screen and (max-device-width: 1280px) and (max-device-height: 768px){
.adjust-height
{
width: 130px;
}
}
#media only screen and (max-device-width: 1920px) and (max-device-height: 1080px){
body
{
overflow-x: hidden;
}
.adjust-height
{
width: 200px;
}
.bottom-grid
{
height: 490px;
}
.tab-menu
{
width: 13.9%;
}
.foot-close
{
padding-right: 170px;
}
.tab-menu-left
{
padding-left:70px;
padding-right:65px;
}
.tab-menu-right
{
padding-left: 0px;
padding-right: 170px;
}
#-moz-document url-prefix() {
.bottom-grid
{
height: 480px;
}
}
*::-ms-backdrop,.bottom-grid {
height: 480px;
}
}
#media only screen and (max-device-width: 1366px) and (max-device-height: 768px) {
.adjust-height
{
width:137px;
transition: all 0.5s;
}
.tab-menu
{
width: 13.8%;
text-align: center;
margin-right:5px;
}
.tab-menu-left
{
padding-left:5px;
}
.tab-menu-right
{
padding-right:67px;
}
.bottom-grid
{
height:179px;
width:100%;
background-color: white;
overflow-y: scroll;
margin-left: 0px;
margin-right: 0px;
padding-left: 0px;
padding-right: 0px !important;
}
.w-img
{
width: 5%;
}
.w-line
{
width: 7.2%;
}
.w-store
{
width: 10.4%;
}
.w-item
{
width: 14.3%;
}
.w-item-name
{
width: 24.4%;
}
.w-qty
{
width: 10.2%;
}
.w-uom
{
width: 6%;
}
.w-price
{
width: 7.8%;
}
.w-total
{
width:7.6%;
}
#-moz-document url-prefix() {
.bottom-grid {
height:167px;
}
.w-qty
{
width: 10.9%;
}
}
#media all and (-ms-high-contrast:none)
{
*::-ms-backdrop,
.bottom-grid {
height: 165px;
margin-bottom: 0px;
} /* IE11 */
*::-ms-backdrop,.main-footer
{
}*::-ms-backdrop,.blue-band
{
font-size: 14px;
}
*::-ms-backdrop,.form-control
{
padding: 3px 6px;
}
*::-ms-backdrop,.select2-selection__arrow b
{
top:25% !important;
}
}
}
Thanks in advance...
When using 2 or more media queries, their order in the CSS matters.
Here is a "bigger first" solution, where body starts gray and change when screen gets smaller
Fiddle demo
body {
background: gray;
}
#media only screen and (max-width: 1000px) {
body {
background: red;
}
}
#media only screen and (max-width: 800px) {
body {
background: blue;
}
}
#media only screen and (max-width: 600px) {
body {
background: green;
}
}
Here is a "smaller first" solution, where body starts gray and change when screen gets bigger
Note, here is the order of the queries switched compared with above max-width rules
Fiddle demo
body {
background: gray;
}
#media only screen and (min-width: 600px) {
body {
background: green;
}
}
#media only screen and (min-width: 800px) {
body {
background: blue;
}
}
#media only screen and (min-width: 1000px) {
body {
background: red;
}
}
to target one reslotion (ex: 1024x768 ) you can use this following code.
#media(min-width:768px) and (max-width:1024px) {
/* enter your css for the super design !!! */
}
Hope, it help you !
Related
This question already has answers here:
Max-Width vs. Min-Width
(7 answers)
Closed 2 years ago.
I'm having some issues with min-width media queries. Right now everything works exactly as designed until the window screen becomes less than 375px. Once the screen goes less than this, .list__content reappears. Does anyone know how once it goes under 375px, it goes disappears?
Where is what I am hoping:
The window is less than or equal to 375px
🚫 .list__content dissapears
✅ .list__items 100% width
The window is between 375px and 768px
✅ .list__items, .list__content 50% width
The window is greater than 768px
✅ .list__items 33% and .list__content is 66%
.list {
position: absolute;
height: 100%;
width: 100%;
background-color: #fff;
display: flex;
}
.list__items,
.list__content {
position: relative;
}
.list__items_header,
.list__content_header {
border-bottom: 1px solid black;
padding: 5px;
}
.list__items {
width: 100%;
border: 0;
}
.list__content {
width: 100%;
display: block;
}
#media (min-width: 375px) {
.list__items {
width: 100%;
border-right: 0;
}
.list__content {
display: none;
}
}
#media (min-width: 768px) {
.list__items {
width: 50%;
border-right: 1px solid black;
}
.list__content {
width: 50%;
display: block;
}
}
#media (min-width: 1032px) {
.list__items {
width: 33%;
border-right: 1px solid black;
}
.list__content {
width: 66%;
display: block;
}
}
<div class="list">
<div class="list__items">
<div class="list__items_header">i-h</div>
items
</div>
<div class="list__content">
<div class="list__content_header">c-h</div>
content
</div>
</div>
You are setting display: none; in .list__content for media query min-width: 375px, but you need to set that for max-width: 375px. The reason is that:
max-width: 375px means 375px and down
min-width: 375px means 375px and up
.list {
position: absolute;
height: 100%;
width: 100%;
background-color: #fff;
display: flex;
}
.list__items,
.list__content {
position: relative;
}
.list__items_header,
.list__content_header {
border-bottom: 1px solid black;
padding: 5px;
}
.list__items {
width: 100%;
border: 0;
}
.list__content {
width: 100%;
display: none;
}
#media (max-width: 375px) {
.list__items {
width: 100%;
border-right: 0;
}
.list__content {
display: none;
}
}
#media (min-width: 375px) {
.list__items {
width: 50%;
border-right: 1px solid black;
}
.list__content {
width: 50%;
display: block;
}
}
#media (min-width: 768px) {
.list__items {
width: 33%;
border-right: 1px solid black;
}
.list__content {
width: 66%;
display: block;
}
}
<div class="list">
<div class="list__items">
<div class="list__items_header">i-h</div>
items
</div>
<div class="list__content">
<div class="list__content_header">c-h</div>
content
</div>
</div>
I changed some of the CSS code. This is how you can do it :
.list {
position: absolute;
height: 100%;
width: 100%;
background-color: #fff;
display: flex;
}
.list__items,
.list__content {
position: relative;
}
.list__items_header,
.list__content_header {
border-bottom: 1px solid black;
padding: 5px;
}
.list__items {
width: 100%;
border-right: 1px solid black;
}
.list__content {
width: 100%;
display: block;
}
#media (max-width: 768px) {
.list__items {
width: 50%;
}
.list__content {
width: 50%;
display: block;
}
}
#media (max-width: 375px) {
.list__items {
width: 100%;
border-width: 0;
}
.list__content {
display: none;
}
}
#media (min-width: 1032px) {
.list__items {
width: 33%;
}
.list__content {
width: 66%;
display: block;
}
}
<div class="list">
<div class="list__items">
<div class="list__items_header">i-h</div>
items
</div>
<div class="list__content">
<div class="list__content_header">c-h</div>
content
</div>
</div>
My media query does not work well and i do not know what i did wrong. It worked sometime ago but not anymore. I am targeting larger screen sizes (1920 x 1080), (1680 x 1080) but some how it works for certain pages but not on others. I am confused as to what to do. It only renders for #media (min-width: 768px) and i do not know what to do. Here is the code.
#media only screen and (min-width: 1600px) {
/* for about page */
.team-back1 {
height: 690px;
background-position: 10% center;
}
.team-right-content {
margin-top: 2%;
}
/* for service page */
.team-back {
height: 690px;
background-position: center 20%;
}
.col-sm-7 {
width: 58.333333%;
margin-top: -1%;
}
div.bhoechie-tab-container {
margin-top: 20px;
margin-bottom: 20px;
width: 69%;
}
/* for home page */
#home-2 .container-fluid {
height: 690px;
}
[class*="cell-2"],
.masonry .post-item {
min-height: 650px;
margin-top: 3.5%;
}
/*for project page */
.pc {
height: 550px;
float: right;
}
.team-back3 {
height: 690px;
background-position: center 20%;
}
/* width: 73%; */
margin-top: 0%;
}
/* for contact page */
/*#contact-us .container-fluid {
height: 760px;}
.contct-lft-bck {
height: 580px !important;}
#map {
height: 580px;}
.contct-middle-back {
height: 580px;}
.contct-right-back {
height: 580px; }*/
/*.row {
margin-top: 3.5%; }*/
}
#media only screen and (min-width: 1680px) {
/* for about page */
.team-right-content p {
font-size: 16px;
}
.team-back1 {
height: 798px;
background-position: 10% center;
}
.team-right-content {
margin-top: 3%;
}
/* for service page */
.team-back {
height: 798px;
background-position: center -35%;
}
.col-sm-7 {
width: 60.333333%;
margin-top: 2%;
}
div.bhoechie-tab-container {
margin-top: 20px;
margin-bottom: 20px;
width: 76%;
}
/* for home page */
#home-2 .container-fluid {
height: 798px;
}
[class*="cell-2"],
.masonry .post-item {
min-height: 680px;
margin-top: 3.5%;
}
/*for project page */
.pc {
height: 580px;
float: right;
}
.team-back3 {
height: 798px;
background-position: center -35%;
}
/* for contact page */
#contact-us .container-fluid {
height: 798px;
}
.contct-lft-bck {
height: 680px !important;
}
#map {
height: 680px;
}
.contct-middle-back {
height: 680px;
}
.contct-right-back {
height: 680px;
}
.row {
margin-top: 3.5%;
}
}
#media only screen and (min-width: 1800px) {
.team-right-content p {
font-size: 16px;
}
/* for projects*/
.team-back3 {
height: 760px;
background-position: 30% center;
}
.project-content {
height: 512px;
}
.bret {
width: 970px;
margin-left: 40px;
}
.project-height {
height: 512px;
margin-top: -4%;
}
/* for about page */
.team-back1 {
height: 760px;
background-position: 10% 20%;
}
.team-right-content {
margin-top: -4%;
}
/* for service page */
.team-back {
height: 760px;
/* background-position: center -40%; */
background-position: 5% -10%;
}
.col-sm-7 {
width: 60.333333%;
margin-top: 4%;
}
div.bhoechie-tab-container {
margin-top: 20px;
margin-bottom: 20px;
width: 89%;
}
/* for home page */
#home-2 .container-fluid {
height: 760px;
}
[class*="cell-2"],
.masonry .post-item {
min-height: 700px;
margin-top: 3.5%;
}
/*for project page */
.pc {
/* height: 600px; */
overflow-y: auto;
/* float: right;} */
/* for contact page */
#contact-us .container-fluid {
height: 760px;
}
#contact-us .container-fluid {
height: 760px;
}
.contct-lft-bck {
height: 685px !important;
}
#map {
height: 685px;
}
.contct-right-back {
height: 685px;
}
.row {
margin-top: 3.5%;
}
.contt {
height: 760px!important;
}
}
}
#media only screen and (max-width:1140px) {
#blog-1 .col-sm-4 {
width: 50%;
}
}
#media only screen and (max-width:1100px) {
.hidden-xs {
display: none!important;
}
}
#media only screen and (max-width:1000px) {
}
#media only screen and (max-width:992px) {
.top-cart {
display: none;
}
.nav-menu ul {
margin-right: 50px;
}
#team .col-sm-offset-5 {
margin-left: 0%;
}
#team .col-sm-7 {
width: 100%;
}
.single-left {
width: 100%!important;
}
.single-left .reply-form-left-col {
width: 100%!important;
}
.single-right {
width: 100%;
}
.cell-2 {
width: 50%;
}
.cell-3 {
width: 50%;
}
}
#media only screen and (max-width:840px) {
.footer-left {
width: 100%;
clear: both;
}
.footer-left p {
text-align: center;
}
.footer-right {
width: 100%;
text-align: center;
}
#blog-1 .col-sm-4 {
width: 80%;
}
#blog-1 .row {
margin: 0 auto;
}
.left-15 {
padding-left: 15px;
}
#contact-us .col-sm-4 {
width: 100%;
}
}
#media only screen and (max-width:767px) {
.bou {
height: 620px;
}
.nav-menu {
display: none;
}
.morphsearch {
display: none;
}
.mobile-drop {
display: block;
}
.extra {
top: 18px!important;
}
#blog-1 .col-sm-4 {
width: 100%;
}
#blog-1 .row {
margin: 0 auto;
}
#blog-single-1 .single-post-detail-image img {
min-width: 100%;
}
#blog-single-1 .blog-item {
padding: 15px;
}
.home-bottom {
font-size: 8px!important;
padding: 7px 12px!important;
}
.btn-group-lg>.btn,
.btn-lg {
line-height: 1.3333333;
margin-right: -80px;
margin-top: 25px;
float: right;
}
.btn-group-md>.btn,
.btn-md {
line-height: 1.3333333;
margin-right: -30px;
margin-top: 25px;
float: right;
display: none;
}
#team .container-fluid {
padding: 50px 10px 10px 10px;
}
.team-back {
height: 100% !important;
}
.team-back1 {
height: 100% !important;
}
.abouty {
padding: 0px;
margin-right: 0px;
}
.team-right-content {
padding: 20px 25px 20px 10px;
}
.project-content {
padding: 20px;
}
.pc {
padding-left: 70px;
}
.serve {
display: none !important;
}
/*.meetus {
visibility: hidden;
}*/
.bighead {
display: none;
}
.bighead2 {
display: none;
}
.righty {
float: left;
}
}
#media only screen and (max-width:640px) {
.home-bottom {
font-size: 5px!important;
padding: 7px 12px!important;
}
.team-right-content .member-content {
text-align: center;
margin: auto;
margin-bottom: 25px;
}
.team-right-content .member-content img {
text-align: center;
margin: auto;
}
.footer-left p {
margin-left: 0px!important;
}
}
#media only screen and (max-width:580px) {
.cell-2 {
width: 100%;
}
.home-2-icon {
padding-top: 40px;
}
[class*="cell-2"],
.masonry .post-item {
min-height: 250px;
}
.cell-3 {
width: 100%;
}
.home3-content-container {
top: 40px;
}
[class*="cell-3"],
.masonry .post-item {
min-height: 250px;
}
}
#media only screen and (max-width:480px) {
.about2-left {
padding: 21px 20px;
}
.about-two-link {
padding-bottom: 80px;
}
}
#media only screen and (max-width:420px) {
.left-post-content {
width: 80%;
padding-bottom: 20px;
}
.left-post-back {
margin-bottom: 20px;
}
.right-post-content {
width: 80%;
padding-bottom: 20px;
}
.right-post-image {
float: left;
}
.right-post-back {
margin-bottom: 20px;
}
}
#media only screen and (min-width:220px) and (max-width:480px) {
}
#media only screen and (min-width:767px) {
.mobile-modal {
display: none;
}
.mob-head {
display: none;
}
.mob-subhead {
display: none;
}
}
#media (min-width: 768px) {
.col-sm-offset-5 {
margin-left: 33.666667%;
}
/*.col-sm-7 {
width: 67.333333%;
} */
.bouts {
width: 58%;
}
.bret {
width: 750px;
}
.pc {
height: 490px;
}
.row {
margin-top: 0%;
}
.team-back1 {
height: 548px;
}
.team-back {
height: 548px;
}
.contct-lft-bck {
height: 548px!important;
}
.contct-middle-back {
height: 548px;
}
.contct-right-back {
height: 548px;
}
#contact-us .container-fluid {
height: 548px;
}
}
#media (min-width: 1200px) {
.cmine {
width: 1024px;
}
}
Probably i am not placing the media query code in accordance or something. I just need an insight. Here is the website link of the actual page CLICK TO OPEN
I think it has something to do with the ordering of your media query css. so why don't you try to order them like below. So your code becomes more user friendly as well:
#media only screen and (max-width:420px) {
.left-post-content {
width: 80%;
padding-bottom: 20px;
}
.left-post-back {
margin-bottom: 20px;
}
.right-post-content {
width: 80%;
padding-bottom: 20px;
}
.right-post-image {
float: left;
}
.right-post-back {
margin-bottom: 20px;
}
}
#media only screen and (max-width:480px) {
.about2-left {
padding: 21px 20px;
}
.about-two-link {
padding-bottom: 80px;
}
}
#media only screen and (max-width:580px) {
.cell-2 {
width: 100%;
}
.home-2-icon {
padding-top: 40px;
}
[class*="cell-2"],
.masonry .post-item {
min-height: 250px;
}
.cell-3 {
width: 100%;
}
.home3-content-container {
top: 40px;
}
[class*="cell-3"],
.masonry .post-item {
min-height: 250px;
}
}
#media only screen and (max-width:640px) {
.home-bottom {
font-size: 5px!important;
padding: 7px 12px!important;
}
.team-right-content .member-content {
text-align: center;
margin: auto;
margin-bottom: 25px;
}
.team-right-content .member-content img {
text-align: center;
margin: auto;
}
.footer-left p {
margin-left: 0px!important;
}
}
#media only screen and (max-width:767px) {
.bou {
height: 620px;
}
.nav-menu {
display: none;
}
.morphsearch {
display: none;
}
.mobile-drop {
display: block;
}
.extra {
top: 18px!important;
}
#blog-1 .col-sm-4 {
width: 100%;
}
#blog-1 .row {
margin: 0 auto;
}
#blog-single-1 .single-post-detail-image img {
min-width: 100%;
}
#blog-single-1 .blog-item {
padding: 15px;
}
.home-bottom {
font-size: 8px!important;
padding: 7px 12px!important;
}
.btn-group-lg>.btn,
.btn-lg {
line-height: 1.3333333;
margin-right: -80px;
margin-top: 25px;
float: right;
}
.btn-group-md>.btn,
.btn-md {
line-height: 1.3333333;
margin-right: -30px;
margin-top: 25px;
float: right;
display: none;
}
#team .container-fluid {
padding: 50px 10px 10px 10px;
}
.team-back {
height: 100% !important;
}
.team-back1 {
height: 100% !important;
}
.abouty {
padding: 0px;
margin-right: 0px;
}
.team-right-content {
padding: 20px 25px 20px 10px;
}
.project-content {
padding: 20px;
}
.pc {
padding-left: 70px;
}
.serve {
display: none !important;
}
/*.meetus {
visibility: hidden;
}*/
.bighead {
display: none;
}
.bighead2 {
display: none;
}
.righty {
float: left;
}
}
#media only screen and (min-width:767px) {
.mobile-modal {
display: none;
}
.mob-head {
display: none;
}
.mob-subhead {
display: none;
}
}
#media (min-width: 768px) {
.col-sm-offset-5 {
margin-left: 33.666667%;
}
/*.col-sm-7 {
width: 67.333333%;
} */
.bouts {
width: 58%;
}
.bret {
width: 750px;
}
.pc {
height: 490px;
}
.row {
margin-top: 0%;
}
.team-back1 {
height: 548px;
}
.team-back {
height: 548px;
}
.contct-lft-bck {
height: 548px!important;
}
.contct-middle-back {
height: 548px;
}
.contct-right-back {
height: 548px;
}
#contact-us .container-fluid {
height: 548px;
}
}
#media only screen and (max-width:840px) {
.footer-left {
width: 100%;
clear: both;
}
.footer-left p {
text-align: center;
}
.footer-right {
width: 100%;
text-align: center;
}
#blog-1 .col-sm-4 {
width: 80%;
}
#blog-1 .row {
margin: 0 auto;
}
.left-15 {
padding-left: 15px;
}
#contact-us .col-sm-4 {
width: 100%;
}
}
#media only screen and (max-width:992px) {
.top-cart {
display: none;
}
.nav-menu ul {
margin-right: 50px;
}
#team .col-sm-offset-5 {
margin-left: 0%;
}
#team .col-sm-7 {
width: 100%;
}
.single-left {
width: 100%!important;
}
.single-left .reply-form-left-col {
width: 100%!important;
}
.single-right {
width: 100%;
}
.cell-2 {
width: 50%;
}
.cell-3 {
width: 50%;
}
}
#media only screen and (max-width:1140px) {
#blog-1 .col-sm-4 {
width: 50%;
}
}
#media only screen and (max-width:1100px) {
.hidden-xs {
display: none!important;
}
}
#media (min-width: 1200px) {
.cmine {
width: 1024px;
}
}
#media only screen and (min-width: 1600px) {
/* for about page */
.team-back1 {
height: 690px;
background-position: 10% center;
}
.team-right-content {
margin-top: 2%;
}
/* for service page */
.team-back {
height: 690px;
background-position: center 20%;
}
.col-sm-7 {
width: 58.333333%;
margin-top: -1%;
}
div.bhoechie-tab-container {
margin-top: 20px;
margin-bottom: 20px;
width: 69%;
}
/* for home page */
#home-2 .container-fluid {
height: 690px;
}
[class*="cell-2"],
.masonry .post-item {
min-height: 650px;
margin-top: 3.5%;
}
/*for project page */
.pc {
height: 550px;
float: right;
}
.team-back3 {
height: 690px;
background-position: center 20%;
}
}
#media only screen and (min-width: 1680px) {
/* for about page */
.team-right-content p {
font-size: 16px;
}
.team-back1 {
height: 798px;
background-position: 10% center;
}
.team-right-content {
margin-top: 3%;
}
/* for service page */
.team-back {
height: 798px;
background-position: center -35%;
}
.col-sm-7 {
width: 60.333333%;
margin-top: 2%;
}
div.bhoechie-tab-container {
margin-top: 20px;
margin-bottom: 20px;
width: 76%;
}
/* for home page */
#home-2 .container-fluid {
height: 798px;
}
[class*="cell-2"],
.masonry .post-item {
min-height: 680px;
margin-top: 3.5%;
}
/*for project page */
.pc {
height: 580px;
float: right;
}
.team-back3 {
height: 798px;
background-position: center -35%;
}
/* for contact page */
#contact-us .container-fluid {
height: 798px;
}
.contct-lft-bck {
height: 680px !important;
}
#map {
height: 680px;
}
.contct-middle-back {
height: 680px;
}
.contct-right-back {
height: 680px;
}
.row {
margin-top: 3.5%;
}
}
#media only screen and (min-width: 1800px) {
.team-right-content p {
font-size: 16px;
}
/* for projects*/
.team-back3 {
height: 760px;
background-position: 30% center;
}
.project-content {
height: 512px;
}
.bret {
width: 970px;
margin-left: 40px;
}
.project-height {
height: 512px;
margin-top: -4%;
}
/* for about page */
.team-back1 {
height: 760px;
background-position: 10% 20%;
}
.team-right-content {
margin-top: -4%;
}
/* for service page */
.team-back {
height: 760px;
/* background-position: center -40%; */
background-position: 5% -10%;
}
.col-sm-7 {
width: 60.333333%;
margin-top: 4%;
}
div.bhoechie-tab-container {
margin-top: 20px;
margin-bottom: 20px;
width: 89%;
}
/* for home page */
#home-2 .container-fluid {
height: 760px;
}
[class*="cell-2"],
.masonry .post-item {
min-height: 700px;
margin-top: 3.5%;
}
/*for project page */
.pc {
/* height: 600px; */
overflow-y: auto;
/* float: right;} */
/* for contact page */
#contact-us .container-fluid {
height: 760px;
}
#contact-us .container-fluid {
height: 760px;
}
.contct-lft-bck {
height: 685px !important;
}
#map {
height: 685px;
}
.contct-right-back {
height: 685px;
}
.row {
margin-top: 3.5%;
}
.contt {
height: 760px!important;
}
}
Also you had some left over curly brackets and some random styles. Also check every line of code properly there might be some errors in some lines involving brackets.
You have some issues with the closing of the queries and also some of the tags...
The some queries are "double closed", there is an additional } before the #media only screen and (min-width: 1680px) and #media only screen and (max-width:1140px) query.
Secondary within #media only screen and (min-width: 1800px) your .pc isn't closed.
A decent validator or even editor should have noticed this..
I want to put a timeline in my website which I found on codepen.
The problem is, it has only three sections(semantic, relative, contained), I tried to add another two sections but the layout gets disrupted and loses responsiveness.
Could anyone guide me in creating extra sections in that timeline without loosing it's responsiveness?
HTML:
<!-- STEPS -->
<section id="Steps" class="steps-section">
<h2 class="steps-header">
Responsive Semantic Timeline
</h2>
<div class="steps-timeline">
<div class="steps-one">
<img class="steps-img" src="http://placehold.it/50/3498DB/FFFFFF" alt="" />
<h3 class="steps-name">
Semantic
</h3>
<p class="steps-description">
The timeline is created using negative margins and a top border.
</p>
</div>
<div class="steps-two">
<img class="steps-img" src="http://placehold.it/50/3498DB/FFFFFF" alt="" />
<h3 class="steps-name">
Relative
</h3>
<p class="steps-description">
All elements are positioned realtive to the parent. No absolute positioning.
</p>
</div>
<div class="steps-three">
<img class="steps-img" src="http://placehold.it/50/3498DB/FFFFFF" alt="" />
<h3 class="steps-name">
Contained
</h3>
<p class="steps-description">
The timeline does not extend past the first and last elements.
</p>
</div>
</div><!-- /.steps-timeline -->
</section>
CSS:
$outline-width: 0;
$break-point: 500px;
#import url(http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
font-family: lato;
}
$gray-base: #999999;
$brand-primary: #3498DB; //Zen Blue
.section-header {
color: $brand-primary;
font-weight: 400;
font-size: 1.4em;
}
.steps-header {
#extend .section-header;
margin-bottom: 20px;
text-align: center;
}
.steps-timeline {
outline: 1px dashed rgba(red, $outline-width);
#media screen and (max-width: $break-point) {
border-left: 2px solid $brand-primary;
margin-left: 25px;
}
#media screen and (min-width: $break-point) {
border-top: 2px solid $brand-primary;
padding-top: 20px;
margin-top: 40px;
margin-left: 16.65%;
margin-right: 16.65%;
}
&:after {
content: "";
display: table;
clear: both;
}
}
.steps-one,
.steps-two,
.steps-three {
outline: 1px dashed rgba(green, $outline-width);
#media screen and (max-width: $break-point) {
margin-left: -25px;
}
#media screen and (min-width: $break-point) {
float: left;
width: 33%;
margin-top: -50px;
}
}
.steps-one,
.steps-two {
#media screen and (max-width: $break-point) {
padding-bottom: 40px;
}
}
.steps-one {
#media screen and (min-width: $break-point) {
margin-left: -16.65%;
margin-right: 16.65%;
}
}
.steps-two {
}
.steps-three {
#media screen and (max-width: $break-point) {
margin-bottom: -100%;
}
#media screen and (min-width: $break-point) {
margin-left: 16.65%;
margin-right: -16.65%;
}
}
.steps-img {
display: block;
margin: auto;
width: 50px;
height: 50px;
border-radius: 50%;
#media screen and (max-width: $break-point) {
float: left;
margin-right: 20px;
}
}
.steps-name,
.steps-description {
margin: 0;
}
.steps-name {
#extend .section-header;
#media screen and (min-width: $break-point) {
text-align: center;
}
}
.steps-description {
overflow: hidden;
#media screen and (min-width: $break-point) {
text-align: center;
}
}
Your CSS needs to be modified to include more divs within the same width. Now since the divs are manually assigned spacing between them rather than a dynamic approach, you can experimentally change the width and margin properties and including .step-four & .step-five in the css as well. I've included one additional div for example. You can try out adding more in this way.
CSS
$outline-width: 0;
$break-point: 500px;
#import url(http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
body {
font-family: lato;
}
$gray-base: #999999;
$brand-primary: #3498DB; //Zen Blue
.section-header {
color: $brand-primary;
font-weight: 400;
font-size: 1.4em;
}
.steps-header {
#extend .section-header;
margin-bottom: 20px;
text-align: center;
}
.steps-timeline {
outline: 1px dashed rgba(red, $outline-width);
#media screen and (max-width: $break-point) {
border-left: 2px solid $brand-primary;
margin-left: 0px;
}
#media screen and (min-width: $break-point) {
border-top: 2px solid $brand-primary;
padding-top: 20px;
margin-top: 40px;
margin-left: 10%;
margin-right: 10%;
}
&:after {
content: "";
display: table;
clear: both;
}
}
.steps-one,
.steps-two,
.steps-three,
.steps-four,
.steps-five{
outline: 1px dashed rgba(green, $outline-width);
#media screen and (max-width: $break-point) {
margin-left: -25px;
}
#media screen and (min-width: $break-point) {
float: left;
width: 25%;
margin-top: -50px;
}
}
.steps-one,
.steps-two {
#media screen and (max-width: $break-point) {
padding-bottom: 40px;
}
}
.steps-one {
#media screen and (min-width: $break-point) {
margin-left: -12%;
margin-right: 12%;
}
}
.steps-two {}
.steps-three,.step-four{
#media screen and (max-width: $break-point) {
margin-bottom: -100%;
}
#media screen and (min-width: $break-point) {
margin-left: 10%;
margin-right: -10%;
float:right;
}
}
.steps-img {
display: block;
margin: auto;
width: 50px;
height: 50px;
border-radius: 50%;
#media screen and (max-width: $break-point) {
float: left;
margin-right: 10px;
}
}
.steps-name,
.steps-description {
margin: 0;
}
.steps-name {
#extend .section-header;
#media screen and (min-width: $break-point) {
text-align: center;
}
}
.steps-description {
overflow: hidden;
#media screen and (min-width: $break-point) {
text-align: center;
}
}
Depending on the number of divs, the width property of the following can be changed.
.steps-one,
.steps-two,
.steps-three,
.steps-four,
.steps-five{
outline: 1px dashed rgba(green, $outline-width);
#media screen and (max-width: $break-point) {
margin-left: -25px;
}
#media screen and (min-width: $break-point) {
float: left;
width: 25%;
margin-top: -50px;
}
}
For Example
3 divs - 33%
4 divs - 25%
5 divs - 20%
and so on
I need 6 steps. I tried for hours, I just can't make it work. I'm pretty sure it's not that hard for someone more experienced. I've had several forks but all are dead end.
Could you help me out please?
http://codepen.io/kjohnson/pen/azBvaE
HTML:
<section id="Steps" class="steps-section">
<h2 class="steps-header">
Responsive Semantic Timeline
</h2>
<div class="steps-timeline">
<div class="steps-one">
<img class="steps-img" src="http://placehold.it/50/3498DB/FFFFFF" alt="" />
<h3 class="steps-name">
Semantic
</h3>
<p class="steps-description">
The timeline is created using negative margins and a top border.
</p>
</div>
<div class="steps-two">
<img class="steps-img" src="http://placehold.it/50/3498DB/FFFFFF" alt="" />
<h3 class="steps-name">
Relative
</h3>
<p class="steps-description">
All elements are positioned realtive to the parent. No absolute positioning.
</p>
</div>
<div class="steps-three">
<img class="steps-img" src="http://placehold.it/50/3498DB/FFFFFF" alt="" />
<h3 class="steps-name">
Contained
</h3>
<p class="steps-description">
The timeline does not extend past the first and last elements.
</p>
</div>
</div><!-- /.steps-timeline -->
CSS:
#import url(http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
font-family: lato;
}
.section-header, .steps-header, .steps-name {
color: #3498DB;
font-weight: 400;
font-size: 1.4em;
}
.steps-header {
margin-bottom: 20px;
text-align: center;
}
.steps-timeline {
outline: 1px dashed rgba(255, 0, 0, 0);
}
#media screen and (max-width: 500px) {
.steps-timeline {
border-left: 2px solid #3498DB;
margin-left: 25px;
}
}
#media screen and (min-width: 500px) {
.steps-timeline {
border-top: 2px solid #3498DB;
padding-top: 20px;
margin-top: 40px;
margin-left: 16.65%;
margin-right: 16.65%;
}
}
.steps-timeline:after {
content: "";
display: table;
clear: both;
}
.steps-one,
.steps-two,
.steps-three {
outline: 1px dashed rgba(0, 128, 0, 0);
}
#media screen and (max-width: 500px) {
.steps-one,
.steps-two,
.steps-three {
margin-left: -25px;
}
}
#media screen and (min-width: 500px) {
.steps-one,
.steps-two,
.steps-three {
float: left;
width: 33%;
margin-top: -50px;
}
}
#media screen and (max-width: 500px) {
.steps-one,
.steps-two {
padding-bottom: 40px;
}
}
#media screen and (min-width: 500px) {
.steps-one {
margin-left: -16.65%;
margin-right: 16.65%;
}
}
#media screen and (max-width: 500px) {
.steps-three {
margin-bottom: -100%;
}
}
#media screen and (min-width: 500px) {
.steps-three {
margin-left: 16.65%;
margin-right: -16.65%;
}
}
.steps-img {
display: block;
margin: auto;
width: 50px;
height: 50px;
border-radius: 50%;
}
#media screen and (max-width: 500px) {
.steps-img {
float: left;
margin-right: 20px;
}
}
.steps-name,
.steps-description {
margin: 0;
}
#media screen and (min-width: 500px) {
.steps-name {
text-align: center;
}
}
.steps-description {
overflow: hidden;
}
#media screen and (min-width: 500px) {
.steps-description {
text-align: center;
}
}
I assume you want something like this?
http://codepen.io/adamk22/pen/LGQQKz
$outline-width: 0;
$break-point: 500px;
#import url(http://fonts.googleapis.com/css?family=Lato:400,700,400italic,700italic);
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
font-family: lato;
}
$gray-base: #999999;
$brand-primary: #3498DB; //Zen Blue
.section-header {
color: $brand-primary;
font-weight: 400;
font-size: 1.4em;
}
.steps-header {
#extend .section-header;
margin-bottom: 20px;
text-align: center;
}
.steps-timeline {
outline: 1px dashed rgba(red, $outline-width);
#media screen and (max-width: $break-point) {
border-left: 2px solid $brand-primary;
margin-left: 25px;
}
#media screen and (min-width: $break-point) {
border-top: 2px solid $brand-primary;
padding-top: 20px;
margin-top: 40px;
margin-left: 8%;
margin-right: 8%;
}
&:after {
content: "";
display: table;
clear: both;
}
}
.steps-one,
.steps-two,
.steps-three,
.steps-four,
.steps-five,
.steps-six{
outline: 1px dashed rgba(green, $outline-width);
#media screen and (max-width: $break-point) {
margin-left: -25px;
}
#media screen and (min-width: $break-point) {
float: left;
width: 12%;
margin-top: -50px;
}
}
.steps-one,
.steps-two,
.steps-three,
.steps-four,
.steps-five,
.steps-six{
#media screen and (max-width: $break-point) {
padding-bottom: 40px;
}
}
.steps-one {
#media screen and (min-width: $break-point) {
margin-left: -8%;
margin-right: 8%;
}
}
.steps-two {
#media screen and (min-width: $break-point) {
margin-right: 8%;
}
}
.steps-three {
#media screen and (min-width: $break-point) {
margin-right: 8%;
}
}
.steps-four {
#media screen and (min-width: $break-point) {
margin-right: 8%;
}
}
.steps-five {
}
.steps-six {
#media screen and (max-width: $break-point) {
margin-bottom: -100%;
}
#media screen and (min-width: $break-point) {
margin-left: 8%;
margin-right: -8%;
}
}
.steps-img {
display: block;
margin: auto;
width: 50px;
height: 50px;
border-radius: 50%;
#media screen and (max-width: $break-point) {
float: left;
margin-right: 20px;
}
}
.steps-name,
.steps-description {
margin: 0;
}
.steps-name {
#extend .section-header;
#media screen and (min-width: $break-point) {
text-align: center;
}
}
.steps-description {
overflow: hidden;
#media screen and (min-width: $break-point) {
text-align: center;
}
}
Most of the changes require you to change the CSS, especially the media queries as you can see in the pen.
I am testing my webpage using the Responsive Design View tool and everything works just fine (the window is responsive and all).
When I try to do the same thing in Chrome, IE or even Mozilla, nothing happens - the page becomes unresponsive. Any ideas why is this happening?
CSS:
#media screen and (min-device-width : 480px) and (max-device-width : 768px) {
.main_container {
width: 100%;
font-size: 16px;
line-height: 22px;
}
#header {
height: 200px;
background-color: tomato;
}
#stanga {
width: 70%;
float: left;
background-color: green;
}
.dreapta {
width: 30%;
float: left;
background-color: red;
}
footer {
height: 150px;
width: 100%;
background-color: black;
clear: both;
}
}
#media screen and (min-device-width : 767px) and (max-device-width : 1200px) {
.main_container {
width: 800px;
margin: 0 auto;
font-size: 16px;
line-height: 22px;
}
#header {
height: 200px;
background-color: tomato;
}
#stanga {
width: 650px;
float: left;
background-color: green;
}
.dreapta {
width: 150px;
float: left;
background-color: red;
}
footer {
height: 150px;
width: 800px;
background-color: black;
clear: both;
}
}
#media only screen and (min-device-width : 1200px) {
.main_container {
width: 900px;
margin: 0 auto;
font-size: 16px;
line-height: 22px;
}
#stanga {
width: 70%;
float: left;
background-color: green;
}
.dreapta {
width: 30%;
float: left;
background-color: red;
}
footer {
height: 150px;
width: 900px;
background-color: black;
clear: both;
}
}
There's a difference between min-width and min-device-width. Use min-width for desktops.
http://www.javascriptkit.com/dhtmltutors/cssmediaqueries2.shtml
The "min-device-width" setting would refer to the width of the device. The "min-width" attribute would refer to the width of the browser.
#media screen and (min-width : 767px) and (max-width : 1200px)
note: It appears that you do have collisions happening right at 768px and also at 480px. I assume it's unintentional, so you may want to fix that also.
I edited your fiddle
https://jsfiddle.net/8dt44c5b/