Why have you got 3 classes that are exactly the same??? Makes no sense.
2 Likes
@Gandalf right, only one is needed. Unless you give them different names, then you could use the shorthand all in one.
For if you want to add images.
1 Like
Did you get it worked out now?
Sort of.
Now I’m trying to remove these duplicates from the code.
I am not quite sure how it would be done.
code: https://jsfiddle.net/3m5f29na/1/
.box {
flex: 0 0 280px;
height: 280px;
margin: 20px;
}
.parent {
display: flex;
background-color: red;
width: 940px;
height: 348px;
justify-content: space-around;
align-items: center;
}
.child1 {
flex: 0 0 280px;
height: 280px;
margin: 20px;
background-image: url("https://via.placeholder.com/280x280");
}
.child2 {
flex: 0 0 280px;
height: 280px;
margin: 20px;
background-image: url("https://via.placeholder.com/280x280");
}
.child3 {
flex: 0 0 280px;
height: 280px;
margin: 20px;
background-image: url("https://via.placeholder.com/280x280");
}
Try something like .child 1, 2, 3 {
1 Like
Got it, thanks.
code: https://jsfiddle.net/75kdLqpa/1/
.child1,
.child2,
.child3 {
flex: 0 0 280px;
height: 280px;
margin: 20px;
}
.child1 {
background-image: url("https://via.placeholder.com/280x280");
}
.child2 {
background-image: url("https://via.placeholder.com/280x280");
}
.child3 {
background-image: url("https://via.placeholder.com/280x280");
}
1 Like
. You can even add that background to the rest of the css. All in the same package.
Thought you wanted your boxes to be blue
You can try this code…
.outer {
max-width: 940px;
height: 348px;
background-color: #000;
}
.centersvg {
display: flex;
justify-content: space-around;
height: 348px;
}
.image1 {
background: red;
width: 33%
}
.image2 {
background: blue;
width: 33%
}
.image3 {
background: green;
width: 33%
}
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.