Nestled Grandchild Boxes Not Responding Or Moving In Flexbox - html

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

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

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.

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