Arrange the child elements using flexbox styling

Greetings. I am facing some challenges in positioning child elements within a flexbox container with the flex-direction:column property.

Can anyone advise on how to place the sign up element next to the sign in element? https://i.sstatic.net/p3DaO.png

html

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
    <meta charset="UTF-8">
    <title>Welcome</title>
<!--    <link rel="stylesheet" href="/css/main.css"/>-->
    <link rel="stylesheet" th:href="@{/css/main.css}"/>
    <link href='https://fonts.googleapis.com/css?family=Montserrat' rel='stylesheet' type='text/css'>
</head>
<body>
    <div class="login-container">
        <h2 class="active">sign in</h2>
        <h2 class="inactive">sign up</h2>
        <form method="post">
            <input type="text" id="fname" placeholder="Enter first name">
            <span>first name</span>
            <input type="text" id="lname" placeholder="Enter last name">
            <span>last name</span>
            <input type="text" id="email" placeholder="Enter your email">
            <span>email</span>
            <input type="submit" value="Submit" class="submit-btn">
        </form>
    </div>
</body>
</html>

css

body, .submit-btn {
    background-color: #d3d3d3;
    font-family: 'Montserrat', sans-serif;
    color:#fff;
    font-size: 14px;
    letter-spacing: 1px;
}

.login-container {
    /*position:relative;*/
    /*align-items: center;*/
    flex-direction: column;
    display:flex;
    height:560px;
    width:405px;
    margin:auto;
    padding:60px 60px;
    box-shadow: 0 30px 60px -5px;
}

h2 {
    padding-left: 12px;
    font-size: 22px;
    text-transform: uppercase;
    padding-bottom: 5px;
    letter-spacing: 2px;
    position: relative;
    /*display: inline-block;*/
    font-weight: 100;
}

Answer №1

As indicated in the remarks, by removing the flex-direction, setting the form width to 100%, and applying flex-wrap: wrap, the issue is resolved. `

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Encountering issues loading background image with Reactjs and Webpack

I've encountered an issue while trying to load a background image in my React project from a custom CSS file. I am currently using Webpack 4. .bgimage { height: 100vh; background: url('../images/header.jpg'); } Unfortunately, the image ...

Mysterious issue with loading images in HTML and PHP

I've been dealing with a puzzling issue on my website design project. The logo image won't load in Firefox unless you hover over the ALT text, then it finally appears. However, this isn't an issue in IE where the logo displays properly. Thi ...

Styling a component next to another using CSS

Struggling with a simple question here. I'm experimenting with HTML and CSS, trying to create a page with a central content box flanked by two arrow images on each side. While the concept isn't too difficult, I'm running into issues with usi ...

Modify the text color upon clicking with a TouchableOpacity component

Would appreciate help from experienced coders. I'm just starting out with coding and React. My goal is to be able to change the text color with a click, and then change it back to the original color with another click. function handleColorChange() { ...

Stopping a velocity.js animation once it has completed: is it possible?

For the pulsating effect I'm creating using velocity.js as a fallback for IE9, refer to box2 for CSS animation. If the mouse leaves the box before the animation is complete (wait until pulse expands and then move out), the pulsating element remains vi ...

What's the best way to position a grid item so that it moves along with its fellow siblings

I am currently utilizing CSS Grids and I have a specific requirement. I need to offset an element so that it moves horizontally across the grid columns while maintaining its width. Additionally, I want the offset value to be added to the element's exi ...

When a <dl> element is nested within an <ol>, it will be rendered as a list format

I'm facing an issue with my CSS that affects how different browsers render definition lists embedded within ordered lists. In IE10, the list displays as expected - a bulleted list inside the ordered list without affecting the numbering. However, Firef ...

What is the best method for selecting or deselecting all checkboxes except for one using a single checkbox in angularjs

$scope.checkAll = function() { if ($scope.selectedAll) { $scope.selectedAll = true; } else { $scope.selectedAll = false; } angular.forEach($scope.MyProducts, function(item) { item.Selected = $scope.selectedAll; }); /*});*/ } <di ...

Develop a Modal Form using Bootstrap (HTML)

I followed a tutorial on creating a modal form with Bootstrap, you can find it here: http://www.youtube.com/watch?v=HCEbp07hfLw I replicated the steps shown in the video, but when I try to open the page in my browser, nothing appears. I have added the Bo ...

Is there any effort being made to utilize jQuery for the css @media screen and (max-width: 768px) function?

Is there a solution for handling the @media screen and (max-width: 768px) in CSS? I have created a responsive navigation bar, but when I change the display property of an element from none to block on mobile screens, it also appears on larger screens. Is ...

What is the process for inspecting the element within a div using jsname with JS?

Struggling to inspect elements within a DIV without using xpath. // Assert.assertEquals("Digite uma senha",driver.findElement(By.xpath("//*[@id=\"view_container\"]/div/div/div[2]/div/div[1]/div/form/span/section/div/div/div[1]/div[2]/div[2] ...

What is the best way to position a button directly to the right of a text box with no space in

Is there a way to perfectly align a submit button to the right of a text or search box, matching the height of the search box, and eliminating any unwanted white space between them? This is my current setup: <input type="text" value="" placehold ...

What causes jQuery's .width() method to switch from returning the CSS-set percentage to the pixel width after a window resize?

After exhaustively console logging my code, I have finally identified the issue: I am attempting to determine the pixel width of some nested divs, and everywhere I look suggests that jQuery's .width() method should solve the problem. The complication ...

The navigation bar extends beyond the container

First time diving into bootstrap and struggling with my items overflowing the container. Here's a snippet of my code: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equi ...

embedding a CSS file specific to the location using a Firefox add-on

I am currently working on a Firefox extension project and require assistance with inserting elements and CSS into the document. I have attempted to follow tutorials on injecting a local CSS file into a webpage with a Firefox extension and inserting CSS us ...

Position the icon in the center using :before pseudo-element

I've been trying to center an icon both horizontally and vertically inside a link using :before, but so far I haven't been successful. Despite my numerous attempts, I can't figure out why the icon won't center. Here's my HTML: & ...

Tips on adjusting text size based on the browser window dimensions

There seems to be an issue with the text when the window size is decreased. It overlaps with the image instead of resizing accordingly. I have tried using media queries, VW, and VH units to adjust the text size based on the window size but it's not wo ...

Having trouble with aligning middle of absolutely positioned block text vertically

I'm facing an issue with aligning h2 text vertically in the middle of a block. The situation is that I have multiple images with different heights but the same width (300px), each with varying amounts of text that may span over several lines and appe ...

"CSS styles applied to the body element do not automatically transfer to the h1

Explore the World of Coding: <body class="pageDesign"> <h1>CSS - A Creative Journey</h1> <p><strong>Discover the beauty of coding</strong> and unlock a world of possibilities with CSS. Let your imagination soar as you d ...

Progress Bar Modules

I am currently working on creating a customizable animated progress bar that can be utilized as follows: <bar [type]="'health'" [percentage]="'80'"></bar> It is functional up to the point where I need to adjust different p ...