Practicing my HTML by doing some frontendmentor.io challenges and have run into a weird snag that I cant seem to find the answer to.
This is how a section on the page i'm making currently looks on firefox, note that this is my desired result
Below is the code I wrote to achieve it.
HTML
<main class="wrapper">
<section class="cards-container">
<section class="cards">
<article>
<h2>Grow Together</h2>
<p>
Generate meaningful discussions with your audience and build a strong, loyal community.Think of the insightful conversations you miss out on with a feedback form.
</p>
</article>
<img class="svg-body" src="./images/illustration-grow-together.svg" alt="Customers using app">
</section>
<section class="cards">
<img class="svg-body" src="./images/illustration-flowing-conversation.svg" alt="Conversation by a tree">
<article>
<h2>Flowing Conversations</h2>
<p>
wouldn't paginate a conversation in real life, so why do it online? Our threads have just-in-time loading for a more natural flow.
</p>
</article>
</section>
CSS
.cards-container{
margin-top: 10rem;
margin-bottom: 10rem;
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 3rem;
}
.cards{
display:flex;
justify-content: space-between;
align-items: center;
border-radius: 25px;
box-shadow: 0px 0px 5px 4px rgba(0,0,0,0.26);
max-height: 30rem;
}
.cards article{
padding: 4rem;
width: 80%;
}
.cards article h2{
font-size: 2em;
}
.svg-body{
padding: 4rem;
max-width: 50%;
height: auto;
}
However when i opened up chrome and brave to check and see how it was working on other browsers and it looks like my SVGs are overflowing outside their sections. (picture below)
What needs to change in my CSS to have my desired output to work in chrome based brewers and not just Firefox? thank you in advance to all responses. Trying to learn frontend webdev and still don't know much but i did a lot of research to get my static page to this point and don't know where to look to fix this browser specific issue I'm running into.
Cheers.
There are many ways to do this, in your case the simplest way:
In your cards you have display:flex, so all you need to do is put a div around your image like so:
<main class="wrapper">
<section class="cards-container">
<section class="cards">
<article>
<h2>Grow Together</h2>
<p>
Generate meaningful discussions with your audience and build a strong, loyal community.Think of the insightful conversations you miss out on with a feedback form.
</p>
</article>
<div class="card-img">
<img class="svg-body" src="https://huddle-page-eight.vercel.app/images/illustration-grow-together.svg" alt="Customers using app">
</div>
</section>
<section class="cards">
<div class="card-img">
<img class="svg-body" src="https://huddle-page-eight.vercel.app/images/illustration-flowing-conversation.svg" alt="Conversation by a tree">
</div>
<article>
<h2>Flowing Conversations</h2>
<p>
wouldn't paginate a conversation in real life, so why do it online? Our threads have just-in-time loading for a more natural flow.
</p>
</article>
</section>
</section>
</main>
Related
I was stay far from coding for a very long time but today I start to do some code, and have fun with html and styling, lol. My goal was to create a simple card gallery which is very simple and every 6 year old child can do in a few lines of some css and html. As you can see I failed and ended up here in stackoverflow looking for some help.
The problem accured when I tried to change my div card into an a link, back in the days it worked well as I can remember. Since there was an premade class with styles, you simply changed the tag and everything was well, except you should change colors on that a may be. But today when I did it, my card... it just messed up... I got really confused. I also tried some different approaches, for example wrap the div into a and it looks wierd too. So the main questions are:
Why everyting is messed up, when simply change tag to a from div (we have premade css class!)? But the card is like became divided into 2 parts...
When I tried to wrapped div card with a. In my DOM I can see that this a is like duplicate itself inside DOM on every element inside itself.
Can anyone explain what is going on here and what is a good approach nowadays?
https://jsfiddle.net/49Lj8dxz/2/
.my-cards-container {
display: flex;
justify-content: center;
align-items: center;
}
.my-card {
display: flex;
flex-direction: column;
justify-items: center;
align-items: center;
text-align:center;
max-width: 228px;
margin-left: 10px;
background: grey;
}
.my-img-container {
width: 100%;
display: block;
}
.my-img-container img {
display: block;
max-width: 100%;
overflow: hidden;
vertical-align: top;
}
<div class="my-cards-container">
<div class="my-card">
<div class="my-img-container">
<img src="https://via.placeholder.com/300" alt="fishy-img">
</div>
<div class="my-content-container">
<h2>Fishy title 1</h2>
<div>Fishy text 1</div>
<div class="my-links-container">
link 1
link 2
</div>
</div>
</div>
<a class="my-card">
<div class="my-img-container">
<img src="https://via.placeholder.com/300" alt="fishy-img">
</div>
<div class="my-content-container">
<h2>Fishy title 2</h2>
<div>Fishy text 2</div>
<div class="my-links-container">
link 1
link 2
</div>
</div>
</a>
<a href="#">
<div class="my-card">
<div class="my-img-container">
<img src="https://via.placeholder.com/300" alt="fishy-img">
</div>
<div class="my-content-container">
<h2>Fishy title 3</h2>
<div>Fishy text 3</div>
<div class="my-links-container">
link 1
link 2
</div>
</div>
</div>
</a>
</div>
I have a row in my page and I want the space in between the borders of the boxes along with keeping the boxes the same size on rotate. The animation is what I want it's that they squares are turning into rectangles and also I don't seem to know how to make them look as stand alone squares with the borders?
.statementnews {
border-style: solid;
border-width: 1px;
padding-left:2em;
/* width: 3vw; */
/* height: 3vh; */
/* justify-content: space-between; */
/* margin-right: 1em; */
transition: width 2s, height 2s, background-color 2s, transform 2s;
}
.statementnews p {
text-align: wrap;
margin-left:1em;
margin-right:1em;
background-color: #F0F0F0;
}
.statementnews:hover {
width: 1em;
height: 1em;
transform: rotate(360deg);
}
.mycolumn2 {
/* display: table-cell; */
margin-top: 2em;
/* width:100%; */
text-align: wrap;
}
.mycolumn2 div {
width:100%;
display: table-cell;
padding-top: 1em;
width: 25vw;
height: 3vh;
justify-content: space-between;
}
<section class="row sectionthird">
<h1 class="mycolumn_header">What they’ve said</h1>
<div class="mycolumn2" id="content2">
<div class="statementnews" id="content2">
<img src="https://i.imgur.com/19iZKat.png" alt="">
<p>“Manage has supercharged our team’s workflow. The ability to maintain
visibility on larger milestones at all times keeps everyone motivated.”</p>
<p>~Anisha Li</p>
</div>
<div class="statementnews" id="content2">
<img src="https://i.imgur.com/nywqgF7.png" alt="">
<p> “We have been able to cancel so many other subscriptions since using
Manage. There is no more cross-channel confusion and everyone is much
more focused.”</p>
<p>~Ali Bravo</p>
</div>
<div class="statementnews" id="content2">
<img src="https://i.imgur.com/TAe4vVN.png" alt="">
<p>“Manage allows us to provide structure and process. It keeps us organized
and focused. I can’t stop recommending them to everyone I talk to!”</p>
<p>~Richard Watts</p>
</div>
<div class="statementnews" id="content2">
<img src="https://i.imgur.com/dnBxz07.png" alt="">
<p>“Their software allows us to track, manage and collaborate on our projects
from anywhere. It keeps the whole team in-sync without being intrusive.”</p>
<p>~Shanai Gough</p>
</div>
</div>
</section>
This is the modified code which would give you the desired output:
html
<section class="row sectionthird">
<h1 class="mycolumn_header">What they’ve said</h1>
<div class="mycolumn2 " id="content2">
<div class="statementnews col">
<img src="https://i.imgur.com/19iZKat.png" alt="">
<p>“Manage has supercharged our team’s workflow. The ability to maintain
visibility on larger milestones at all times keeps everyone motivated.”</p>
<p>~Anisha Li</p>
</div>
<div class="statementnews col">
<img src="https://i.imgur.com/nywqgF7.png" alt="">
<p> “We have been able to cancel so many other subscriptions since using
Manage. There is no more cross-channel confusion and everyone is much
more focused.”</p>
<p>~Ali Bravo</p>
</div>
<div class="statementnews col">
<img src="https://i.imgur.com/TAe4vVN.png" alt="">
<p>“Manage allows us to provide structure and process. It keeps us organized
and focused. I can’t stop recommending them to everyone I talk to!”</p>
<p>~Richard Watts</p>
</div>
<div class="statementnews col">
<img src="https://i.imgur.com/dnBxz07.png" alt="">
<p>“Their software allows us to track, manage and collaborate on our projects
from anywhere. It keeps the whole team in-sync without being intrusive.”</p>
<p>~Shanai Gough</p>
</div>
</div>
</section>
and add this to your css
.col {
min-width:25vw;
}
Also, there was one error. The id of all the div of statement news were the same. In HTML, ids can't be the same. So I have removed the ids out of divs if you wish to add them, give them different naming(content1, content, content3 and so on).
Please note that the cards had the same id's. I've changed the CSS a bit hopefully this is what you meant
.statementnews {
width: 300px;
height: 300px;
padding-left: 30px;
box-shadow: 0 0 10px;
border-radius: 10px;
margin: 10px;
overflow: auto;
transition: width 2s, height 2s, background-color 2s, transform 2s;
}
.statementnews p {
text-align: wrap;
margin-left: 1em;
margin-right: 1em;
background-color: #f0f0f0;
}
.statementnews:hover {
transform: rotate(360deg);
}
.mycolumn2 {
width: 100%;
margin-top: 2em;
display: flex;
flex-direction: row;
justify-content: center;
text-align: wrap;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="stylesheet" href="style.css" />
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=" />
<title></title>
</head>
<body>
<section class="row sectionthird">
<h1 class="mycolumn_header">What they’ve said</h1>
<div class="mycolumn2" id="content2">
<div class="statementnews" id="content_1">
<img src="https://i.imgur.com/19iZKat.png" alt="" />
<p>
“Manage has supercharged our team’s workflow. The ability to
maintain visibility on larger milestones at all times keeps
everyone motivated.”
</p>
<p>~Anisha Li</p>
</div>
<div class="statementnews" id="content_2">
<img src="https://i.imgur.com/nywqgF7.png" alt="" />
<p>
“We have been able to cancel so many other subscriptions since
using Manage. There is no more cross-channel confusion and
everyone is much more focused.”
</p>
<p>~Ali Bravo</p>
</div>
<div class="statementnews" id="content_3">
<img src="https://i.imgur.com/TAe4vVN.png" alt="" />
<p>
“Manage allows us to provide structure and process. It keeps us
organized and focused. I can’t stop recommending them to
everyone I talk to!”
</p>
<p>~Richard Watts</p>
</div>
<div class="statementnews" id="content_4">
<img src="https://i.imgur.com/dnBxz07.png" alt="" />
<p>
“Their software allows us to track, manage and collaborate on
our projects from anywhere. It keeps the whole team in-sync
without being intrusive.”
</p>
<p>~Shanai Gough</p>
</div>
</div>
</section>
</body>
</html>
</body>
</html>
:root {
--clr-primary: #f9baaa;
--clr-graylight: #c13828;
--clr-graymed: #c13828;
--border-radius: 0.5rem;
}
*,
*:before,
*:after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: "Playfair Display", "Montserrat";
background:square(#f9baaa);
}
main {
margin: 0rem;
}
.wrapper {
display: flex;
flex-wrap: wrap;
justify-content: center;
margin-top: 1rem;
}
.testimonial-container {
border-radius: square(--border-radius);
padding: 2rem;
width: 300px;
height: 350px;
position: relative;
margin: 0.75rem;
background: #f9baaa;
text-align: center;
}
<head>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&family=Playfair+Display:wght#400;500;700;900&display=swap" rel="stylesheet">
</head>
<body>
<main>
<h3>Here's a summary of what we'll cover together:</h3>
<div class="wrapper">
<div class="testimonial-container">
<h3 class="testimonial">Step 1: Language</h3>
<div class="name">
<p class="name">The language and questions we use internally play a big part in our life and affect our mindset. During our first session we will uncover the language you use and questions you ask yourself.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 2: Values</h3>
<div class="name">
<p class="name">We will dedicate two sessions to getting you clarity on your values; what is important to you in life. We will also assess how these play a role in your life and how to get you more of them.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 3: Beliefs</h3>
<div class="name">
<p class="name">Our fourth and fifth sessions will be focused on understanding your beliefs. This is the time where we tackle those little voices inside your head that may be holding you back.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 4: Identity</h3>
<div class="name">
<p class="name">During the identity session we will create your identity blueprint: Who are you? What do you do? How do you choose to live?</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 5: Purpose</h3>
<div class="name">
<p class="name">We will then move on to identify your purpose. What makes you get up in the morning? Having a clear purpose can help you create goals, guide your life decisions and offer you a sense of direction.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Wrap-Up Session</h3>
<div class="name">
<p class="name">Lastly, we will end by looking at how you can move forward with this new understanding and clarity. How can you utilise what you’ve discovered to help you lead your best life?</p>
</div>
</div>
flex boxes I'm trying to align - first 1 is not aligned
Hello,
I'm trying to align my flex boxes (I have 6) - they are all aligned except for the first 1.
I have tried a few different things but quite new to this so not sure what will work. The last box was not aligning but I fixed that by inputting height: 350px.
I'm creating this on Squarespace - Paloma template.
Is someone able to offer any advice?
Thank you!
:root {
--clr-primary: #f9baaa;
--clr-graylight: #c13828;
--clr-graymed: #c13828;
--border-radius: 0.5rem;
}
*,
*:before,
*:after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: "Playfair Display", "Montserrat";
background:square(#f9baaa);
}
main {
margin: 0rem;
}
.wrapper {
display: flex;
flex-wrap: wrap;
justify-content: center;
margin-top: 1rem;
}
.testimonial-container {
border-radius: square(--border-radius);
padding: 2rem;
width: 300px;
height: 350px;
position: relative;
margin: 0.75rem;
background: #f9baaa;
text-align: center;
}
<head>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans&family=Playfair+Display:wght#400;500;700;900&display=swap" rel="stylesheet">
</head>
<body>
<main>
<h3>Here's a summary of what we'll cover together:</h3>
<div class="wrapper">
<div class="testimonial-container">
<h3 class="testimonial">Step 1: Language</h3>
<div class="name">
<p class="name">The language and questions we use internally play a big part in our life and affect our mindset. During our first session we will uncover the language you use and questions you ask yourself.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 2: Values</h3>
<div class="name">
<p class="name">We will dedicate two sessions to getting you clarity on your values; what is important to you in life. We will also assess how these play a role in your life and how to get you more of them.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 3: Beliefs</h3>
<div class="name">
<p class="name">Our fourth and fifth sessions will be focused on understanding your beliefs. This is the time where we tackle those little voices inside your head that may be holding you back.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 4: Identity</h3>
<div class="name">
<p class="name">During the identity session we will create your identity blueprint: Who are you? What do you do? How do you choose to live?</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Step 5: Purpose</h3>
<div class="name">
<p class="name">We will then move on to identify your purpose. What makes you get up in the morning? Having a clear purpose can help you create goals, guide your life decisions and offer you a sense of direction.</p>
</div>
</div>
<div class="testimonial-container">
<h3 class="testimonial">Wrap-Up Session</h3>
<div class="name">
<p class="name">Lastly, we will end by looking at how you can move forward with this new understanding and clarity. How can you utilise what you’ve discovered to help you lead your best life?</p>
</div>
</div>
I am new to web development and I am facing an issue. I want to display three div's next to each other. So, I applied display:inline-block to the three div's. But, still the Div's are stacked one below another and not next to each other.
Codepen link: https://codepen.io/shanjaynithin/pen/XWmBPYd
Desired output:
Sample image
You can use flex for this:
.container {
display: flex;
width: 100%;
justify-content: space-between;
}
.boxes {
margin: 10px;
border: 1px solid red;
}
img{
height:100px;
width:100px;
}
<div class="container">
<div class="boxes">
<img src="http://placekitten.com/301/301" alt="snappy-process">
<h3>Snappy Process</h3>
<p>Our application process can be completed in minutes, not hours. Don’t get
stuck filling in tedious forms.</p>
</div>
<div class="boxes">
<img class="eg" src="http://placekitten.com/301/301" alt="affordable-prices">
<h3 >Affordable Prices</h3>
<p>We don’t want you worrying about high monthly costs. Our prices may be low,
but we still offer the best coverage possible.</p>
</div>
<div class="boxes">
<img src="http://placekitten.com/301/301" alt="people-first">
<h3>People First</h3>
<p>Our plans aren’t full of conditions and clauses to prevent payouts. We make
sure you’re covered when you need it.</p>
</div>
</div>
.container {
display: flex;
width: 100vw;
}
<div class="container">
<div class="boxes">
<img src="images/icon-snappy-process.svg" alt="snappy-process">
<h3>Snappy Process</h3>
<p>Our application process can be completed in minutes, not hours. Don’t get
stuck filling in tedious forms.</p>
</div>
<div class="boxes">
<img class="eg" src="images/icon-affordable-prices.svg" alt="affordable-prices">
<h3>Affordable Prices</h3>
<p>We don’t want you worrying about high monthly costs. Our prices may be low,
but we still offer the best coverage possible.</p>
</div>
<div class="boxes">
<img src="images/icon-people-first.svg" alt="people-first">
<h3>People First</h3>
<p>Our plans aren’t full of conditions and clauses to prevent payouts. We make
sure you’re covered when you need it.</p>
</div>
</div>
<div id="app">
<div>One</div>
<div>Two</div>
<div>Three</div>
</div>
#app div{
float: left;
width: 200px;
height: 200px;
border: 1px solid;
}
I'm trying to make a menu responsive menu which will change orientation with the page marge, smoothly if it's possible (it would be perfect if I can use some css translation to animate it)
The icons should fill the marge but not impinge on the text.
I have currently made this with inline-block, margin and #media only screen and (max-width:XXX) but it's not smooth at all
I want to know if there is a better way to do that, with flex box maybe? I'm not as good as I want to in advenced css, so if you have some clue or advice to how to do that, I would be grateful.
The html is basic :
<aside id="menu-right">
<div class="icon-float icon-white">
Up
</div>
<div class="icon-float">
Home
</div>
<div class="icon-float">
Search
</div>
<div class="icon-float">
Down
</div>
</aside>
My css is pretty ugly so... retart from penuts seems to be a good idea...
Thanks for your reading!
#menu-right {
display: flex;
flex-flow: row wrap-reverse;
justify-content: flex-end;
align-content: flex-end;
}
.icon-float {
width: 100px;
height: 100px;
border: 1px solid black;
border-radius: 50%;
}
<aside id="menu-right">
<div class="icon-float icon-white">
4
</div>
<div class="icon-float">
3
</div>
<div class="icon-float">
2
</div>
<div class="icon-float">
1
</div>
</aside>