Making the body of html a flexbox

Is this code ok?

body {
display: flex;
}

I am creating a flexbox for the login page of my website. I ask a non human intelligence on how to center the whole box the container of the login page. this is it’s recommendation. should I use this? because one developer in codecademy advise students not use flexbox to design entire page. or mybe I just misunderstood the teacher.
:slight_smile:

I don’t know what you or they mean by ‘the entire page’. There are frameworks like Bootstrap which switched to using flexboxes for their layout system and that is used super often and it works perfectly fine. But when using Bootstrap for example, you would not set the body to flex, but certain sections of a website. They use a system of rows and columns. Have look how it’s used there as a reference:

2 Likes

Hi, there!

I understand why they would advise students not do so, as using flex or grid on the body may complicate the design further in the project. However, if the developer understands how flex or even grid works, then it should be easy to avoid complications. There are different ways you can center elements both vertically and horizontally on a webpage, and both flex and grid are two common ways to do so. (Though you would need more than just display: flex; or display: grid; to do so)

However, there can be limitations to AI responses. I would recommend Googling or looking for related StackOverflow queries before going to AI.

1 Like

yeah so many ways to solved a problem but I differ to the vast experience of software developers in codecademy who have the foresight on this matters. much better to learn from others experience than commit my own mistake. heheheheehe thank you.