Flexbox not working

Display flex is not working on fieldset element with text-box class

html code

<section id="contact">
    <form>
        <fieldset class="text-box">
            <fieldset class="input-text-box">
                <input type="text" required>
                <label> hela namn </label>
            </fieldset>

            <fieldset class="input-text-box">
                <input type="email" required>
                <label> email </label>
            </fieldset>
        </fieldset>
    </form>
</section>

css code

#contact {
    background-color: var(--white);
    padding: 64px;
}

#contact > form {
    width: 100%;
    max-width: 1024px;
    margin: auto;
}

#contact .input-text-box  {
    width: 50%;
    margin: auto;
    position: relative;
    user-select: none;
}

#contact .input-text-box input {
    width: 100%;
    margin: auto;
    padding: 16px 24px;
    box-sizing: border-box;

    border-bottom: solid 4px var(--blue);
    background-color: transparent;
    outline: none;

    z-index: 1;
    position: relative;

    font-family: var(--oswald-ff);
    font-weight: lighter;
    letter-spacing: 1.5px;
    color: var(--black);
    font-size: 16px;
}

#contact .input-text-box:first-child input {
    text-transform: capitalize;
}

#contact .input-text-box label {
    position: absolute;
    bottom: 0px;
    left: 0px;
    margin-left: 16px;
    width: 100%;
    
    font-family: var(--arvo-ff);
    text-transform: uppercase;
    word-spacing: 5px;
    letter-spacing: 3px;
    font-weight: lighter;
    
    color: var(--black);
    filter: brightness(350%);

    transform-origin: left;
    transform: translateY(-250%) scale(0.9);
    transition: var(--ts-1);
    z-index: 0;
    cursor: default;
}

#contact .input-text-box input:focus + label,
#contact .input-text-box input:valid + label {
    transition: var(--ts-1);
    transform: translateY(-300%) scale(1.1);
    color: var(--dark-blue);
}

#contact .text-box {
    display: flex;
}

In case if you have not fixed it yet, make sure you provide a link to your code so that we could sort it out.

Here is link to code on codepen
https://codepen.io/yousef_040/pen/vrqwyb

I think its working, and how do you want your text-box elements to be placed…?

I want flex-item to be placed side by side.

#contact .texts-box {
  display: flex;
  justify-content: space-around;
}

Try this

EDIT: I think you have changed the class name from .text-box (In the snippet here) to .texts-box(In the codepen)

the problem is not with the class name becuase i have the same class name in the snippet and in the real code.

No no, i did not mention it as a problem, i just said in case you missed it.

I understand, sometimes type the wrong class name but this time i have used the right class name.

I have solved the problem, the “display: flex;” doesn’t work on fieldset elements

1 Like

here is a more detailed explanation about this problem