Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

html, css, bootstrap

@BossArifSanjaya

Desktop design screenshot for the 3-column preview card component coding challenge

This is a solution for...

  • HTML
  • CSS
1newbie
View challenge

Design comparison


SolutionDesign

Solution retrospective


how do you set the container so that its position is centered horizontally and vertically? how to make the container to be responsive correctly?

Community feedback

@iamsomraj

Posted

Hi,

To center a container both horizontally and vertically using flexbox in CSS, you can apply the following styles to the container:

.container {
display: flex;
justify-content: center; /* Centers horizontally */
align-items: center; /* Centers vertically */
height: 100vh; /* Set the container height to the full viewport height for vertical centering */
}

By using display: flex, the child elements inside the container will be automatically centered both horizontally and vertically.

This approach centers the container's content regardless of screen size, making it responsive to various devices.

I can see that you have used bootstrap. Personally, I would highly recommend using Tailwind. Let me know if you need any help.

1

@BossArifSanjaya

Posted

@iamsomraj thanks for the advice, this is very useful for me

1

@iamsomraj

Posted

Thank you, @BossArifSanjaya, for your prompt response. If you found my reply helpful, I kindly ask for an upvote. This will assist others with similar doubts in discovering the solution more easily.

0

@gabrieltrt

Posted

Friend, in the mobile version you need to use the flex-direction:column; property in the main container.

And when you do media queries, you must change the main container's flex-direction property to Row instead of column.

in short, study more about flexbox! he will solve pretty much everything in this challenge.

0

@BossArifSanjaya

Posted

@gabrieltrt thank you for advice....

1

Please log in to post a comment

Log in with GitHub
Discord logo

Join our Discord community

Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!

Join our Discord