1

I'm trying to make a login modal for my website -

code pen link @ https://codepen.io/carlyraejepsenstan/pen/vYGNVJp

This is a screenshot:

slanted forms

I tried adding float:left to the input styles. It works, but the modal background gets compressed into a tiny line:

enter image description here

Any ideas what's going on?

Temani Afif
  • 245,468
  • 26
  • 309
  • 415
Aaron
  • 37
  • 4
  • If you use float, you need to set `overflow: hidden;` to the container. – Itay Aug 13 '20 at 02:37
  • But a simple `text-align: left` to the container would suffice (without float) – Itay Aug 13 '20 at 02:38
  • 1
    Dont use floating in 2020. Flex is your friend: `display: flex; flex-direction: column; align-items: flex-start;` add these properties to `
    ` element
    – lgabster Aug 13 '20 at 03:24

2 Answers2

2

You can add clearfix.

Add the clearfix class inside the HTML like this:

<div id="modal-container" class="clearfix">

And define clearfix in your CSS like this:

.clearfix::after {
    content: "";
    clear: both;
    display: block;
}

View at codepen

Safwan Samsudeen
  • 1,645
  • 1
  • 10
  • 25
ppwater
  • 2,315
  • 4
  • 15
  • 29
  • 1
    Thanks! What does `content: ""` do? – Aaron Aug 13 '20 at 05:02
  • 1
    if you are going to write ::after then you have to write content:"something" but since we don't need it, I just writed no contents. I don't know it realy well so look at this link too : https://stackoverflow.com/questions/8554043/what-is-a-clearfix – ppwater Aug 13 '20 at 05:45
0

Just add <form style="float:left;> or You can add a p tag <p align="left"></p>