CSS failed on Safari - html

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

Related

Nestled Grandchild Boxes Not Responding Or Moving In Flexbox

The fourth block's red cards (the block on middle right of the image) will not respond to look like this image in figma.
They currently look like this on my live server from VScode.
Here is my HTML.
Below is my latest effort in CSS.
I have been trying to fix this since last Wednesday.
I'm completely new to this field and this is my first class (front end web dev).
What am I fundamentally misunderstanding here?
.parent {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
width: 1152px;
margin: auto;
background-color: #370617;
}
.container {
background-color: #F48C06;
border: none;
border-radius: 8px;
width: 468px;
height: 160px;
position: relative;
margin: 20px;
display: flex;
}
.card {
background-color:#9D0208;
border: none;
border-radius: 4px;
width: 78px;
height: 78px;
margin: 15px;
display: flex;
justify-content: center;
align-items: center;
}
.first-block {
display: flex;
justify-content: flex-start;
align-items: flex-end;
width: 468px;
height: 160px;
margin: 20px
}
.second-block {
display: flex;
justify-content: center;
align-items: center;
width: 468px;
height: 160px;
margin: 20px;
}
.sb-cardone {
height: 120px;
}
.sb-cardtwo {
height: 120px;
}
.sb-cardthree {
height: 120px;
}
.third-block{
display: flex;
justify-content: flex-end;
align-items: center;
}
.fourth-block {
display: flex;
width: 468px;
height: 160px;
}
.fb-cardone {
display: flex;
justify-content: flex-start;
align-items: flex-start;
margin-top: 20px;
margin-left: 20px;
}
.fb-cardtwo {
display: flex;
justify-content: center;
align-self: center;
}
.fb-cardthree {
display: flex;
justify-content: flex-end;
align-self: flex-end;
}
body {
background-color: #370617;;
margin: 0;
min-height: 100vh;
}

How to make proper form of media queries?

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;
}
}

How to mimic same design as the picture?

The body is flexbox ,I do not how to display the divs in top-right corner and bottom-left corner?
body {
box-sizing: border-box;
margin: 0;
height: 100vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: #f5f7fb;
color: #122763;
}
main {
display: flex;
flex-direction: column;
align-items: center;
}
*,
*::before,
*::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
height: 100vh;
width: 100%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background-color: #f5f7fb;
color: #122763;
}
/**top Right**/
main {
display: flex;
flex-direction: column;
align-items: center;
position: absolute;
top: 0;
right: 0;
}
/**Bottom Left**/
main {
display: flex;
flex-direction: column;
align-items: center;
position: absolute;
bottom: 0;
left: 0;
}
/**No Need to set body position to relative**/
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
main {
height: 100vh;
width: 100%;
background-color: #f5f7fb;
color: #122763;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-between;
overflow: hidden;
}
main::before {
content: '';
height: 40vh;
width: 20%;
margin-right: -9vw;
margin-top: -18vh;
align-self: flex-end;
background-color: #fffad2;
border-radius: 44%;
}
main::after {
content: '';
height: 40vh;
width: 25%;
margin-left: -14vw;
margin-bottom: -18vh;
align-self: flex-end;
align-self: flex-start;
background-color: #deecf9;
border-radius: 50%;
}
.container {
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
}
.container > h1 {
margin: 1%;
}
.container > p {
margin: 0.5% 1% 1% 1%;
font-size: large;
}
.container > button {
font-size: medium;
color: white;
background-color: #4d5b9e;
border-radius: 1rem;
width: 95px;
height: 45px;
border: 0;
margin: 2%;
cursor: pointer;
}

CSS Background Color of ::before element not showing

I'm following some tutorials to do some coding, and I've found that for some reason, when i use the ::before pseudo attribute, and try to set the background color of it, nothing is visible.
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #1d061a;
font-family: consolas;
}
.container {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
padding: 40px 0;
}
.container .box {
position: relative;
width: 320px;
height: 400px;
display: flex;
justify-content: center;
align-items: center;
margin: 40px 30px;
transition: 0.5s;
}
.container .box::before {
content: '';
position: absolute;
top: 0;
left: 50px;
width: 50%;
height: 100%
background: #fff;
border-radius: 8px;
transform: skewX(15deg);
transition: 0.5s;
}
(I couldn't figure out how to get the code to display correctly)
Little syntax error; all that was missing was a " ; " after your height declaration in the ::before selector, causing your background-color to not be picked up.
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #1d061a;
font-family: consolas;
}
.container {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
padding: 40px 0;
}
.container .box {
position: relative;
width: 320px;
height: 400px;
display: flex;
justify-content: center;
align-items: center;
margin: 40px 30px;
transition: 0.5s;
}
.container .box::before {
content: '';
position: absolute;
top: 0;
left: 50px;
width: 50%;
height: 100%;
background: #fff;
border-radius: 8px;
transform: skewX(15deg);
transition: 0.5s;
}
<div class="container">
<div class="box"></div>
</div>
You've got some error in your ::before missing a ; after height declaration.
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #1d061a;
font-family: consolas;
}
.container {
display: flex;
justify-content: center;
align-items: center;
flex-wrap: wrap;
padding: 40px 0;
}
.container .box {
position: relative;
width: 320px;
height: 400px;
display: flex;
justify-content: center;
align-items: center;
margin: 40px 30px;
transition: 0.5s;
background: #f00;
}
.container .box::before {
content: '';
position: absolute;
top: 0;
left: 50px;
width: 50%;
height: 100%;
display: block;
background: #fff;
border-radius: 8px;
transform: skewX(15deg);
transition: 0.5s;
}
<div class="container">
<div class="box"></div>
</div>

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>