Email-box appears in a seemingly "random" location

I am currently engrossed in my informatics project, which involves building a sample dating site. However, I have encountered some difficulties in getting everything to align correctly. Everything was working fine until my email box appeared in the wrong place (although Dreamweaver displays it as intended). I suspect that the issue may have something to do with my margins or padding. Any assistance would be highly appreciated!

Thank you in advance,

HTML+CSS (many words are Dutch and I am a beginner in this field, so please bear with me if the code is not top-notch. In my actual project, I have separated my HTML and CSS into different files):

<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">

* {
    padding:0;
    margin:0;
    border:0;       
}

body {
    background-color:#666;
    font-family:corbel; 
}

.container {
    width: 1240px;  
}

#HomeLeftSideRegister {
    float:left;
}

.Form {
    width: 1240px;
    height: 600px;  
    display:block;
    background-color:white;
    border-radius: 10px;
    margin-top: 111px;
    margin-left:auto;
    margin-right:auto;
}

#Registreernu {
    margin-left:45px;
    color: #3c948b;
    font-size: 70px;        
}

#Home-email {
    color: #000;
    font-size: 30px;
    margin-top: 30px;       
    margin-left: 245px;

}


.Email {
    color:#666;
    font-weight:bold;

}

#useremail {
    height: 22px;
    width: 281px;
    font-size: 20px;
    border-width: 1px;
    border-style:solid;
    margin: 10px 0px 10px 149px;    
}

.Gender {
    color: #000;
    font-size: 18px;
    height: 155px;
    width: 130px;
    border: none;
    float: left;
    margin-left: 25px;
    margin-top: 10px;

}

#gender-1 {
    margin-left:150px;  

}

.Radiolabel {
    margin-top: 20px;
}

.Roundbutton {
    background-color: #3c948b;
    height: 74px;
    width: 196px;
    border-radius: 10px;
    color: white;
    font-size: 25px;
    font-weight: 500;
    float:none;
    margin-left:193px;
}

#input {
    margin-top: 220px;


}

#BlouseManImage {
    float:right;
    margin: 44px 70px auto auto;    
}

</style>

</head>

<body>

<div id="Content" class="Container">

    <section id="Home-Register">
        <form class="Form" action="#" >
            <div id="HomeLeftSideRegister">
                <div id="Registreernu">REGISTREER NU</div>
                <h2 id="Home-email">EMAIL:</h2>
                <input name="email" type="email" class="Email" id="useremail"/>
              <fieldset class="Gender" id="gender-1">

              <H3>IK BEN EEN:</H3>

              <div class="Radiolabel">  
                <label>
                  <input type="radio" name="amman" class="styled-radio" value="Man"/>
                    Man
                </label> <br />

                <label>
                    <input type="radio" name="amvrouw" class="styled-radio" value="Vrouw"/>
                    Vrouw                
                </label>
               </div>
            </fieldset>
            <fieldset class="Gender">

              <H3 class="">IK ZOEK EEN:</H3>

              <div class="Radiolabel">
                  <label>
                    <input type="radio" name="likeman" class="styled-radio" value="Man"/>
                    Man
                </label> 
                <br />

                  <label>
                    <input type="radio" name="likevrouw" class="styled-radio" value="Vrouw"/>
                    Vrouw   
                </label> 
                  <br />

                <label>
                    <input type="radio" name="likebeide" class="styled-radio" value="Beide"/>
                    Beide
                </label>
              </div>
            </fieldset>

            <div id="input">
                <input type="submit" value="GA VERDER" class="Roundbutton">
            </div>


          </div>
                <div id="BlouseManImage"><img src="Images/Man_Registreer.jpg" alt="Ik probeer het gewoon" height="535" width="577"  />
            </div>          
        </form>       
    </section>


    <section id="reclame">



    </section>



</div>

</body>
</html>

Answer №1

It looks like you've encountered the 'float' rule issue :-)

The .Gender divs have been set to float: left, causing them to align to the left and making the email field appear on the right.

To fix this, I floated the email field as well so that it would appear correctly. Additionally, I separated the two gender divs, giving them distinct classes (GenderBen and GenderZoek) to differentiate between what you are and what you're looking for.

The updated CSS code is:

.Email {
    color:#666;
    font-weight:bold;
    float: left;
}
.GenderBen {
    color: #000;
    font-size: 18px;
    height: 155px;
    width: 130px;
    border: none;
    float: left;
    clear: both;
    margin-left: 25px;
    margin-top: 10px;
}
.GenderZoek {
    color: #000;
    font-size: 18px;
    height: 155px;
    width: 130px;
    border: none;
    float: left;
    margin-left: 25px;
    margin-top: 10px;
} 

And here is the updated HTML with the modified divs:

<fieldset class="GenderBen" id="gender-1">
<H3>IK BEN EEN:</H3>
<div class="Radiolabel">  
<label>
<input type="radio" name="amman" class="styled-radio" value="Man"/>
Man
</label> <br />
<label>
<input type="radio" name="amvrouw" class="styled-radio" value="Vrouw"/>
Vrouw                
</label>
</div>
</fieldset>

<fieldset class="GenderZoek">
<H3 class="">IK ZOEK EEN:</H3>
<div class="Radiolabel">
<label>
<input type="radio" name="likeman" class="styled-radio" value="Man"/>
Man
</label> 
<br />
<label>
<input type="radio" name="likevrouw" class="styled-radio" value="Vrouw"/>
Vrouw   
</label> 
<br />
<label>
<input type="radio" name="likebeide" class="styled-radio" value="Beide"/>
Beide
</label>
</div>
</fieldset>

You can see the result by visiting http://jsfiddle.net/yn8bjfbf/

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

dynamic webpage resizing using html and css

Looking for a way to make my SharePoint window automatically resize when the user changes their browser size. I'm using the web version of SharePoint at work and don't have access to Designer. <style type="text/css"> #dgwrap { HEIGHT: ...

Maintaining responsiveness, CSS grid will automatically adjust the height of each element to be equal

I am facing an issue with my grid layout. Each element in the grid has an image and other divs below it. The problem arises when the screen size changes, causing the elements to scale automatically due to responsive width. I want all the images to have the ...

Responsive Design: Concealing a Sidebar with CSS

Seeking assistance with optimizing the layout of my app, . It currently displays a menu on the left and a login form in the center, with a graph shown to users upon logging in. Is there a way to configure it so that when accessed on iOS: 1) the left menu ...

Discover a new method for mastering jQuery Draggable: an advanced technique

Click here for the interactive demo. I'm trying to create a draggable effect for the cover element within the pic-area, but I only want it to be draggable until it completely fills the space without any white gaps. Please have a look at the example b ...

Centering an icon in tandem with Typography text using Material UI

Is there a way to align an icon with the text so that they are on the same level? Currently, it seems like the icon is slightly above the text. I've tried using padding-top: 5px and margin-top: 5px, but those solutions didn't work as expected. ...

Alignment of Bootstrap 5 card text and buttons

I've been diving into the BootStrap 5 Crash Course from this YouTube link: https://www.youtube.com/watch?v=4sosXZsdy-s. The final website from the tutorial can be found here: One specific part focuses on using Cards, but I'm facing an issue wher ...

Extracting the href attribute from a child <a> tag

I am struggling to retrieve the value of the href within the code structure below: <div class=""> <div class=""> <div class=""> <a href=""><img src=""></a> </div> </div> </div> The m ...

Unlock the secrets of programming with the must-have guide to mastering variables

As a newcomer to the world of programming, I may be jumping ahead by asking this question too quickly. While reading a book, I came across something that confused me. Why is it necessary to create a variable for the password box element? Wouldn't the ...

Receiving a null value when attempting to access the ids of dynamically created HTML elements using JavaScript

Encountering issue with accessing ids of dynamically generated HTML elements using javascript In my current project, I am attempting to dynamically alter the ids of div elements and remove buttons that are appended to the parent div. The desired functiona ...

What is the best way to output a received HTML page from the server?

I'm currently working on printing an HTML page that was generated using Node.js on my server. After sending the page to the client side as a response to an AJAX request, I have stored it in a JavaScript variable. var resp_json = printRequest.getRespo ...

Retrieve the scrolling height in Vue.js 2 window

I need to apply the sticky class to the navbar when a user scrolls down, and remove it when they scroll back up. To achieve this, I am attempting to calculate the scrolled height. Currently, my code looks like: mounted(){ this.setUpRoutes(); wind ...

Is it possible to develop Hybrid Apps specifically for Windows Tablets/Surface devices?

We have created a Hybrid App for Android devices and made it compatible with Windows by using Adobe PhoneGap Build to generate a .XAP package from the existing Source Code. We believe that this .XAP package can easily be deployed on a Windows Mobile devic ...

What significance does the symbol "'" hold in the ng-style attribute?

Can someone explain the purpose of the " \' " in this code snippet? <div ng-style="{ \'cursor\': row.cursor }" Is there a reason why it can't be written simply as <div ng-style="{ cursor: row.cursor }" Here is ...

Having trouble removing or adding a class to an HTML element?

I have a collection of three colored buttons. My goal is to allow users to select one button at a time, triggering it to be highlighted while the others are unselected. Each button corresponds to an object with a property called isSelected that can be set ...

Unlock the Power of Vue Draggable in Vue.js 3 with These Simple Steps

When attempting to implement Draggable in Vue.js 3, I encountered an error message: VueCompilerError: v-slot can only be used on components or <template> tags. Below is a snippet of my code: <draggable tag="transiton-group" name="s ...

Ways to speed up the disappearance of error messages

There is a minor issue that I find quite annoying. The validation error message takes too long (approximately 3 seconds) to disappear after a valid input has been entered. Let me give you an example. Do you have any tips or tricks to resolve this problem? ...

Dealing with rowspan and colspan issues in Internet Explorer

Currently, I am facing the challenge of creating a table with a complex system of colspans and rowspans. If you want to take a look at it, you can view it here This is the HTML code for the table: <table cellspacing="0" cellpadding="0" style="table-la ...

How do I modify the sidebar width with CSS code?

I am trying to adjust the width of the right sidebar on my website. The current layout leaves too much empty space on the right side and makes it appear crowded next to the main content and images in the center. Despite exploring various solutions provide ...

What is the latest CSS browser support for the min() and max() functions in 2018?

I am considering implementing the use of the min() and max() functions in my project. I'm curious about the current browser support as of 2018. Do you think it is necessary to include the @supports at-rule? For example, I could write: .px-4-safe { ...

Display different website content in a div when the page loads

My current project involves creating a team website hosted on a LAMP server. This website includes various "team pages" dedicated to different age groups. I am facing the challenge of integrating "external" content (from another page within my domain) into ...