How to make proper form of media queries? - html

I am trying to make my website look adaptive for both smartphones and desktops. There're Chart and Info blocks. I want them to be positioned across the width on desktops and laptops, and one above the other on the mobiles. But Chart goes into first block at the small mobile width. What can I do here?
.
It already looks nice and good at desktops.
#media only screen and (min-width: 320px) and (max-width: 1281px) {
/* ??? */
}
<div class="justify-content-flex-start" style="margin-top: 10px; padding-left: 0%; padding-right: 1%;margin-left:15%; min-width: 320px; max-width: 1281px;">
<div class="row" style="margin-top: 10px; padding-left: 1%; padding-right: 1%;">
</div>
</div> <!-- First block -->
<div class="container" style="width: 360px; margin-top: 10px; padding-left: 1%; padding-right: 1%; padding-bottom: 10%; margin-right: 25%">
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.5.0/Chart.min.js"></script>
<script src="./src/js/graph.js"></script>
<div id="FlexCGraph justify-content: center" ><iframe class="chartjs-hidden-iframe" style="display: block; overflow: hidden; border: 0px; margin: 0px; inset: 0px; height: 100%; width: 100%; position: absolute; pointer-events: none; z-index: -1;" src=></iframe>
<canvas id="global-speed-chart" style="display: block; height: 250px; width: 100%; padding-right: 1%; margin-right: -8%; margin-top: -78%; padding-bottom: 5%; padding-top: 1%;"></canvas>
</div>
</div>
<!-- Chart -->
#media (min-width: 1920px) {
.dashboard {
padding: 15px;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
position: relative;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
align-items:center;
align-content: center;
justify-content: flex-end;
}
}
#media only screen and (min-device-width: 360px) {
.dashboard__desc {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
width: 100%;
position: relative;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: row;
flex-direction: row;
padding-top: 10px;
align-content: center;
align-items: center;
justify-content: flex-start;
}
}
#media only screen and (min-device-width: 360px){
.crypto-card{
width: 360px;
height: 215px;
background: white;
right: 40px;
padding: 10px;
margin: 10px;
border: 0.1px solid rgb(220, 220, 220);
max-width: 360px;
align-content: center;
align-items: center;
justify-content: center;
}
}
#media only screen and (min-device-width: 360px){
.row{
align-content: center;
align-items: center;
justify-content: center;
}
}
#media only screen and (min-device-width: 360px){
.crypto-card .body{
width: 100%;
padding: 20px;
margin: 2px;
font-size: -0.4rem;
font-family: 'Myriad Pro', sans-serif;
position: relative;
top: 5px;
align-content: center;
align-items: center;
justify-content: center;
}
}
#FlexCGraph
{
align-content: center;
align-items: center;
justify-content: flex-end;
position: absolute;
padding: 10px 10px 10px 10px;
margin: auto;
width: 360px;
height: 215px;
max-width: 360px;
-webkit-flex-grow: 0;
flex-grow: 0;
-webkit-flex-shrink: 0;
flex-shrink: 0;
-webkit-align-self: auto;
align-self: auto;
background-color: transparent;
border: 0.1px solid rgb(220, 220, 220);
box-sizing: border-box;
flex: 0 0 50%;
}
#wb_FlexCGraph
{
align-content: center;
align-items: center;
justify-content: flex-end;
padding-left: 10%;
visibility: visible;
display: block;
-webkit-flex-grow: 0;
flex-grow: 0;
-webkit-flex-shrink: 0;
flex-shrink: 0;
-webkit-align-self: auto;
align-self: auto;
}
}

Related

React application shrinking on iPhone

So when testing in Chrome, I used a Window Resizer to check the viewport sizes and everything looked amazing. After deployment, I ended up getting this:
The application is ReactJS and is hosted using Nginx on an Ubuntu server (not that that should matter).
styles.css
.header-text {
font-size: 212px !important;
color: white;
line-height: 0.8 !important;
}
.subheader-text {
line-height: 1;
font-size: 44px !important;
}
.content-boxes {
display: flex;
flex-direction: column;
position: relative;
}
.content-box {
align-self: center;
width: 400px;
height: 400px;
border-radius: 32px;
background-color: #27285C;
display: flex;
flex-direction: column;
justify-content: center;
margin-bottom: 50px;
}
.content-box-header {
font-size: 72px !important;
text-align: center;
}
.content-box-container {
grid-area: content-box-container;
width: 400px;
height: 400px;
border-radius: 32px;
background-color: #27285C;
display: flex;
flex-direction: column;
justify-content: center;
margin-bottom: 50px;
margin-left: 250px;
justify-self: center;
}
.content-box-description {
grid-area: content-box-description;
justify-self: left;
}
.fullscreen-content {
display: flex;
flex-direction: column;
}
#media(max-width: 1200px) {
.header-text {
font-size: 144px !important;
}
.subheader-text {
font-size: 44px !important;
}
.fullscreen-content {
margin-top: -20px !important;
}
.content-box {
width: 200px;
height: 200px;
}
.content-boxes-container {
display: flex !important;
flex-direction: column !important;
justify-content: center;
padding: 15px;
margin-bottom: 15px;
}
.content-box-container {
align-self: center;
margin-left: 0px;
}
.content-box-description {
max-width: 80%;
color: #27285C;
align-self: center;
justify-self: left;
margin-top: -15px;
}
.cards-container {
display: flex;
justify-content: center;
flex-direction: column !important;
margin: 0px !important;
z-index: 1;
}
.image-card {
margin-right: 0px !important;
}
}
#media(min-width: 1201px) {
.header-text {
font-size: 212px !important;
}
.fullscreen-content {
margin-top: -350px !important;
overflow-y: hidden;
}
.content-boxes-container {
display: grid;
grid-template-columns: 0.9fr 0.3fr 1.8fr;
grid-template-rows: 1fr;
gap: 0px 0px;
grid-auto-flow: row;
grid-template-areas:
"content-box-container content-box-container content-box-description"
"content-box-container content-box-container content-box-description";
align-items: center;
margin-left: 200px;
}
.content-box-description {
max-width:60%;
color: #27285C;
margin-top: -50px !important;
}
.about-section {
width: 60% !important;
text-indent: 64px;
}
}
.cards-container {
display: flex;
justify-content: center;
flex-direction: row;
margin: 15px;
z-index: 1;
}
.image-card {
align-self: center;
width: 532px;
height: 832px;
background-color: white;
border-radius: 32px;
margin-bottom: 15px;
margin-right: 45px;
}
.cards-container .picture-card {
align-self: center;
}
.about-section {
width: 90%;
display: flex;
flex-direction: column;
align-self: center;
margin: 45px;
}
#font-face {
font-family: 'JockeyOne-Regular';
src: local('JockeyOne-Regular'), url('../layouts/fonts/JockeyOne-Regular.ttf') format('truetype');
/* other formats include: 'woff2', 'truetype, 'opentype',
'embedded-opentype', and 'svg' */
}
Any help would be appreciated! Thanks.

How to make this responsive design?

I want to make this responsive design using html and css with flexbox:
this is my code:
span {
font-weight: bold;
color: aqua;
}
.parent {
display: flex;
width: 100%;
height: 100px;
background-color: white;
justify-content: space-around;
align-items: center;
}
.child {
display: flex;
width: 18%;
height: 71px;
background-color: #eee;
align-items: center;
justify-content: center;
}
/*small screen*/
#media (max-width: 991px) {
span {
font-weight: bold;
color: black;
}
.parent {
display: flex;
width: 100%;
background-color: white;
justify-content: space-around;
align-items: center;
flex-wrap: wrap;
}
.child {
display: flex;
width: 100%;
height: 71px;
background-color: #eee;
align-items: center;
justify-content: center;
margin-bottom: 10px;
}
}
/*medium screen*/
#media (min-width: 992px) {
span {
font-weight: bold;
color: red;
}
.parent {
display: flex;
width: 100%;
background-color: white;
align-items: center;
flex-wrap: wrap;
}
.child {
display: flex;
width: 45%;
height: 71px;
background-color: #eee;
align-items: center;
justify-content: center;
margin-bottom: 15px;
}
}
/*large screen*/
#media (min-width: 1200px) {
span {
font-weight: bold;
color: aqua;
}
.parent {
display: flex;
width: 100%;
height: 100px;
background-color: white;
justify-content: space-around;
align-items: center;
}
.child {
display: flex;
width: 18%;
height: 71px;
background-color: #eee;
align-items: center;
justify-content: center;
}
}
<div class="parent">
<div class="child"><span>Product one</span>This Is Product</div>
<div class="child"><span>Product two</span>This Is Product</div>
<div class="child"><span>Product three</span>This Is Product</div>
<div class="child"><span>Product four</span>This Is Product</div>
</div>
there is many differences between my code and the design above
how can I fix the problems in the code to have like this design?
small screen: max-width: 991px.
medium screen: min-width: 992px.
large screen: min-width: 1200px.
You should add flex-direction:column; to .child class.

Drop down box not visible

When hoovering the menu element a drop down box shall appear. It does but it is cut. Not sure what is wrong here if the Ul nav list cuts it. The drop down menu has been tested ok but not with this menu. I also tried to change the z-index, but without any result. Can you see anything that can inhibit the drop down menu to show?
var navList = document.getElementById("nav-lists");
function Show() {
navList.classList.add("_Menus-show");
}
function Hide() {
navList.classList.remove("_Menus-show");
}
*,
*::before,
*::after {
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
body {
font-family: sans-serif;
margin: 0;
padding: 0;
}
.container {
height: 80px;
background-color: #333333;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
overflow: hidden;
}
.container .logo {
max-width: 250px;
padding: 0 10px;
overflow: hidden;
}
.container .logo a {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
height: 60px;
}
.container .logo a img {
max-width: 100%;
max-height: 60px;
}
.container .navbar {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
padding: 0 10px;
}
.container .navbar ul {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
list-style: none;
margin: 0;
padding: 0;
}
.container .navbar ul li a {
text-decoration: none;
color: #999999;
font-size: 20px;
text-transform: uppercase;
display: block;
height: 60px;
line-height: 60px;
cursor: pointer;
padding: 0 10px;
}
.container .navbar ul li a:hover {
color: #ffffff;
background-color: rgba(23, 23, 23, 0.9);
}
.container .navbar ul .close {
display: none;
text-align: right;
padding: 10px;
}
.container .navbar ul .close span {
font-size: 40px;
display: inline-block;
border: 1px solid #cccccc;
padding: 0 10px;
cursor: pointer;
}
.container .navbar .icon-bar {
padding: 18px 8px;
width: 50px;
height: 60px;
display: none;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
cursor: pointer;
}
.container .navbar .icon-bar i {
background-color: #ffffff;
height: 2px;
}
#media only screen and (max-width: 650px) {
.container {
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
.container .logo {
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
}
.container .navbar {
-webkit-box-flex: 0;
-ms-flex: 0;
flex: 0;
}
.container .navbar ul {
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
position: fixed;
left: 100%;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
background: #ffffff;
width: 100%;
height: 100%;
overflow: auto;
-webkit-transition: left .3s;
-o-transition: left .3s;
transition: left .3s;
}
.container .navbar ul li a {
padding: 10px;
font-size: 20px;
height: auto;
line-height: normal;
color: #555555;
}
.container .navbar ul .close {
display: block;
}
.container .navbar .icon-bar {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.container .navbar ._Menus-show {
left: 0;
}
}
.body {
max-width: 700px;
margin: 0 auto;
padding: 10px;
}
/* start of drop down */
/* dropdown css starts here */
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #0009f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 10;
}
.dropdown:hover .dropdown-content {
display: block;
}
.desc {
padding: 15px;
width: 400px;
height: 160px;
font-family: Arial;
}
.desc_Info {
padding: 15px;
width: 400px;
height: 220px;
font-family: Arial;
}
span {
cursor: pointer;
}
/* hand over menu item */
/* END drop down menu */
<html>
<head>
<title>Nav bar</title>
</head>
<body>
<div class="container">
<div class="logo">
<img src="./bilder/logo2.jpg" alt="Start">
</div>
<div class="navbar">
<div class="icon-bar" onclick="Show()">
<i></i>
<i></i>
<i></i>
</div>
<ul id="nav-lists">
<li class="close"><span onclick="Hide()">×</span></li>
<li class="elements">
<div class="dropdown">
Cars
<div class="dropdown-content">
<div class="desc">assadsadsad<br /><br /> asdasdsadasdsadsad
<br /><br /> adsasdsasaasdasdasdsdasad
</div>
</div>
</div>
</li>
<li>Bikes</li>
</ul>
</div>
</div>
<div class="body">
<p>Hello yes !</p>
</div>
</body>
</html>
Remove the overflow: hidden; from the .container. This cuts off the dropdown.
var navList = document.getElementById("nav-lists");
function Show() {
navList.classList.add("_Menus-show");
}
function Hide() {
navList.classList.remove("_Menus-show");
}
*,
*::before,
*::after {
box-sizing: border-box;
-webkit-box-sizing: border-box;
}
body {
font-family: sans-serif;
margin: 0;
padding: 0;
}
.container {
height: 80px;
background-color: #333333;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
}
.container .logo {
max-width: 250px;
padding: 0 10px;
overflow: hidden;
}
.container .logo a {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
height: 60px;
}
.container .logo a img {
max-width: 100%;
max-height: 60px;
}
.container .navbar {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
padding: 0 10px;
}
.container .navbar ul {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
list-style: none;
margin: 0;
padding: 0;
}
.container .navbar ul li a {
text-decoration: none;
color: #999999;
font-size: 20px;
text-transform: uppercase;
display: block;
height: 60px;
line-height: 60px;
cursor: pointer;
padding: 0 10px;
}
.container .navbar ul li a:hover {
color: #ffffff;
background-color: rgba(23, 23, 23, 0.9);
}
.container .navbar ul .close {
display: none;
text-align: right;
padding: 10px;
}
.container .navbar ul .close span {
font-size: 40px;
display: inline-block;
border: 1px solid #cccccc;
padding: 0 10px;
cursor: pointer;
}
.container .navbar .icon-bar {
padding: 18px 8px;
width: 50px;
height: 60px;
display: none;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
cursor: pointer;
}
.container .navbar .icon-bar i {
background-color: #ffffff;
height: 2px;
}
#media only screen and (max-width: 650px) {
.container {
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
.container .logo {
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
}
.container .navbar {
-webkit-box-flex: 0;
-ms-flex: 0;
flex: 0;
}
.container .navbar ul {
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;
position: fixed;
left: 100%;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
background: #ffffff;
width: 100%;
height: 100%;
overflow: auto;
-webkit-transition: left .3s;
-o-transition: left .3s;
transition: left .3s;
}
.container .navbar ul li a {
padding: 10px;
font-size: 20px;
height: auto;
line-height: normal;
color: #555555;
}
.container .navbar ul .close {
display: block;
}
.container .navbar .icon-bar {
display: -webkit-box;
display: -ms-flexbox;
display: flex;
}
.container .navbar ._Menus-show {
left: 0;
}
}
.body {
max-width: 700px;
margin: 0 auto;
padding: 10px;
}
/* start of drop down */
/* dropdown css starts here */
.dropdown {
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #0009f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
z-index: 10;
}
.dropdown:hover .dropdown-content {
display: block;
}
.desc {
padding: 15px;
width: 400px;
height: 160px;
font-family: Arial;
}
.desc_Info {
padding: 15px;
width: 400px;
height: 220px;
font-family: Arial;
}
span {
cursor: pointer;
}
/* hand over menu item */
/* END drop down menu */
<html>
<head>
<title>Nav bar</title>
</head>
<body>
<div class="container">
<div class="logo">
<img src="./bilder/logo2.jpg" alt="Start">
</div>
<div class="navbar">
<div class="icon-bar" onclick="Show()">
<i></i>
<i></i>
<i></i>
</div>
<ul id="nav-lists">
<li class="close"><span onclick="Hide()">×</span></li>
<li class="elements">
<div class="dropdown">
Cars
<div class="dropdown-content">
<div class="desc">assadsadsad<br /><br /> asdasdsadasdsadsad
<br /><br /> adsasdsasaasdasdasdsdasad
</div>
</div>
</div>
</li>
<li>Bikes</li>
</ul>
</div>
</div>
<div class="body">
<p>Hello yes !</p>
</div>
</body>
</html>

Is my CSS code not set up correctly for media queries?

Ok so first off I apologise if my title is not very clear! I'm fairly new to css and currently following the landing page project with freecodecamp, I'm at the point where I wanted to start adding media queries to my code (maybe should have added them as I went along). I'm using there example code as a reference to see what I should be doing, but it just seems that no matter what media queries I add the page doesn't respond how I expect it too, or it just messes up the whole css code!
Here is a link to my codepen - https://codepen.io/rorymx/pen/XWmbbzY
and this is some of the html and css from it.
<div id="wrapper">
<header id="header">
<div id="img-div">
<img id="header-img" src="https://i.pinimg.com/236x/2d/50/8b/2d508b7019bf7b8711673825c7bd3252.jpg">
</div>
<nav id="nav-bar">
<ul>
<li><a class="nav-link" href="#features">Features</a> </li>
<li><a class="nav-link" href="#how-it-works">How it works</a> </li>
<li><a class="nav-link" href="#pricing">Pricing</a> </li>
</ul>
</nav>
</header>
</div>
please ignore the look its just temporary as the code is mainly what I'm playing about with.
For example. one of the media queries i was trying to add was
#media (max-width: 650px) header{flex-wrap: wrap;}
to the header
#media (max-width: 650px) {
nav {
margin-top: 10px;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
padding: 0 50px;
}
}
which i got from the example code, which i played about with but it just seemed to mess everything up!
If anyone could shed some light as why this may be happening, or if i've not set some things up properly, or if the code is just complete rubbish and needs starting again!
I do not see a media query in the code example that you provided via the Codepen link (https://codepen.io/rorymx/pen/XWmbbzY) that you have provided. So, the question seems a bit unclear.
That said, from the way the code looks that you have included in your description above in addition to the context that you've provided from the code that you included from your Codepen link ... it could potentially be something as simple as the way you're selecting the nav element, but I can't say this conclusively with the information given.
What I will say, however, is that if I add the following code to the bottom of the stylesheet you have provided from Codepen, it works great! Here's what I wrote:
body{
margin: 0px;
padding: 0px;
backgroun-color:
}
#wrapper{
display: flex;
height: 100vh;
flex-direction: column;
margin: 0px;
padding: 0px;
width: 100%;
}
#header{
width: 100%;
height: 100px;
background-color: grey;
position: fixed;
top: 0;
display: flex;
justify-content: space-around;
align-items: center;
}
#img-div{
display: flex;
position: relative;
background-color: grey;
width: 50%;
height: 100%;
}
#header-img{
display: flex;
position: relative;
height: 100%;
left: 25%;
}
#nav-bar > ul{
display: flex;
justify-content: space-around;
float: right;
flex-direction: row;
width: 30vw;
list-style: none;
font-size: 20px;
}
#body{
flex: 1;
display: block;
background-color: #B2B2B2;
padding-top: 100px;
width: 100vw;
}
#title{
text-align: center;
}
#submit-sec{
margin: 10px;
display:flex;
justfy-content: center;
flex-directon: column;
text-align: center;
align-items: center;
height: 100px;
}
form {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin: auto;
}
#email{
width: 25vw;
height: 10vh;
font-size: 18px;
}
#submit{
background-color: yellow;
font-size: 20px;
font-weight: bold;
padding: 5px 15px;
border-radius: 5px;
width: 50%;
margin: 10px 0px;
}
#submit:hover{
background-color: #C4C100 ;
transition: background-color 0.5s;
cursor: pointer;
}
#features{
display: flex;
flex-direction: column;
justify-content: center;
margin: 0px;
padding: 2px;
width: 100vw;
align-items: center;
}
.feature-div{
display: flex;
flex-direction: column;
justify-content: center;
align-items: left;
width: 60vw;
margin: 15px 0px;
}
.feature-div > h2{
margin: 2px 0px;
}
.feature-div > p{
font-size: 17px;
margin: 2px 0px;
}
#how-it-works{
display: flex;
justify-content: center;
margin: 20px 0px;
}
iframe{
max-width: 540px;
width: 100vw;
}
#pricing{
display: flex;
justify-content: center;
width: 100%;
margin: 10px 0px;
}
.price-sec{
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
width: calc(100% / 3);
border: 2px solid #000000;
margin: 50px;
padding: 0px;
border-radius: 4px;
background-color: #FBEDA6;
}
.price-sec > .price-head{
font-size: 20px;
font-weight: bold;
background-color: #E8E8E8;
width: 100%;
text-transform: uppercase;
padding: 10px 0px;
}
.price-sec > ol{
padding: 0px;
}
ol > li{
font-size: 20px;
list-style: none;
padding: 2px;
}
.price-sec > button{
border: 0;
margin: 10px;
font-weight: 400;
font-size: 20px;
padding: 5px 10px;
background-color: #FD0008;
color: white;
}
.price-sec > button:hover{
background-color: #971B1B;
transition: background-color 0.5s;
cursor: pointer;
}
#footer{
background-color: grey;
margin-top: 0px;
padding: 2px;
}
#footer > ul{
display: flex;
justify-content: flex-end;
margin: 5px;
}
#footer > ul > li{
margin: 0px 5px;
padding: 0px 10px;
list-style: none;
}
#footer > span{
display: flex;
justify-content: flex-end;
margin: 5px;
padding: 0px;
}
#media (max-width: 600px) {
nav {
background-color: red;
}
}
Adding my test code seems to work fine from a technical standpoint since a part of the nav element changes its background color from transparent to red when I shrink the window down smaller than a width of 600px as reflected by the media query I wrote. As for the code that you have provided, I was able to successfully add that code as well in the following way:
body{
margin: 0px;
padding: 0px;
backgroun-color:
}
#wrapper{
display: flex;
height: 100vh;
flex-direction: column;
margin: 0px;
padding: 0px;
width: 100%;
}
#header{
width: 100%;
height: 100px;
background-color: grey;
position: fixed;
top: 0;
display: flex;
justify-content: space-around;
align-items: center;
}
#img-div{
display: flex;
position: relative;
background-color: grey;
width: 50%;
height: 100%;
}
#header-img{
display: flex;
position: relative;
height: 100%;
left: 25%;
}
#nav-bar > ul{
display: flex;
justify-content: space-around;
float: right;
flex-direction: row;
width: 30vw;
list-style: none;
font-size: 20px;
}
#body{
flex: 1;
display: block;
background-color: #B2B2B2;
padding-top: 100px;
width: 100vw;
}
#title{
text-align: center;
}
#submit-sec{
margin: 10px;
display:flex;
justfy-content: center;
flex-directon: column;
text-align: center;
align-items: center;
height: 100px;
}
form {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
margin: auto;
}
#email{
width: 25vw;
height: 10vh;
font-size: 18px;
}
#submit{
background-color: yellow;
font-size: 20px;
font-weight: bold;
padding: 5px 15px;
border-radius: 5px;
width: 50%;
margin: 10px 0px;
}
#submit:hover{
background-color: #C4C100 ;
transition: background-color 0.5s;
cursor: pointer;
}
#features{
display: flex;
flex-direction: column;
justify-content: center;
margin: 0px;
padding: 2px;
width: 100vw;
align-items: center;
}
.feature-div{
display: flex;
flex-direction: column;
justify-content: center;
align-items: left;
width: 60vw;
margin: 15px 0px;
}
.feature-div > h2{
margin: 2px 0px;
}
.feature-div > p{
font-size: 17px;
margin: 2px 0px;
}
#how-it-works{
display: flex;
justify-content: center;
margin: 20px 0px;
}
iframe{
max-width: 540px;
width: 100vw;
}
#pricing{
display: flex;
justify-content: center;
width: 100%;
margin: 10px 0px;
}
.price-sec{
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
width: calc(100% / 3);
border: 2px solid #000000;
margin: 50px;
padding: 0px;
border-radius: 4px;
background-color: #FBEDA6;
}
.price-sec > .price-head{
font-size: 20px;
font-weight: bold;
background-color: #E8E8E8;
width: 100%;
text-transform: uppercase;
padding: 10px 0px;
}
.price-sec > ol{
padding: 0px;
}
ol > li{
font-size: 20px;
list-style: none;
padding: 2px;
}
.price-sec > button{
border: 0;
margin: 10px;
font-weight: 400;
font-size: 20px;
padding: 5px 10px;
background-color: #FD0008;
color: white;
}
.price-sec > button:hover{
background-color: #971B1B;
transition: background-color 0.5s;
cursor: pointer;
}
#footer{
background-color: grey;
margin-top: 0px;
padding: 2px;
}
#footer > ul{
display: flex;
justify-content: flex-end;
margin: 5px;
}
#footer > ul > li{
margin: 0px 5px;
padding: 0px 10px;
list-style: none;
}
#footer > span{
display: flex;
justify-content: flex-end;
margin: 5px;
padding: 0px;
}
#media (max-width: 650px) {
nav {
background-color: red;
}
header {
flex-wrap: wrap;
}
nav {
margin-top: 10px;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
text-align: center;
padding: 0 50px;
}
}
If you add this code to your stylesheet in the Codepen that you have provided, you will see that the code is in fact working the way it is written. As far as what you wish to achieve, however, this may not be the solution that you are looking for. With a little more guidance on what the end result you wish to achieve is, I'm happy to continue to guide and help where I can.
Try this:
#media (max-width: 650px) {
#nav-bar > ul {
flex-direction: column;
}
}

CSS failed on Safari

I have the following HTML:
<div class="my-select-color-items">
<div ng-repeat="color in colors | orderBy:descricao" class="my-select-color-item" ng-click="select(color)" ng-style="bgColor(color)">
<h1 class="title">{{color.descricao}}</h1>
</div>
</div>
I have the following CSS:
.my-select-img-items,
.my-select-color-items {
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -moz-flex;
display: -ms-flexbox;
display: flex;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-justify-content: space-around;
-ms-flex-pack: distribute;
justify-content: space-around;
padding-top: 10px;
padding-left: 5px;
padding-right: 5px;
}
.my-select-img-item:empty,
.my-select-color-item:empty {
border: none;
height: 0;
padding-top: 0;
padding-bottom: 0;
margin-top: 0;
margin-bottom: 0;
}
.my-select-img-item,
.my-select-color-item {
position: relative;
margin-bottom: 10px;
margin-left: 5px;
margin-right: 5px;
}
.my-select-img-item {
height: 200px;
width: 200px;
}
.my-select-color-item {
height: 80px;
width: 80px;
}
.my-select-color-item .title {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
text-align: center;
color: #fff;
font-size: 12px;
}
It works fine, like this:
http://postimg.org/image/gvkavjnsx/
The problem happens using Safari. See below:
http://postimg.org/image/tb3lrxpe3/
Does anyone knows how can I solve this problem?
Best regards
Wilton