0

I'm having a problem with the floating property.

My code: JSFiddle

I want it to look this way: printscreen

What can I do, I want the button to NOT float like the other two elements above the button.

My css: (You can see my HTML on JSFiddle)

#upload_photo_form > p {
    margin: 3px;
}

#upload_one {
    width: 150px;
    height: 60px;
    background-image: url('image, doesnt matter, looke the same anyways');
    background-size: 100%;
    float: left;
    border: 1px solid grey;
    border-radius: 3px;
}

#upload_two {
    margin-left: 5px;
    width: 150px;
    height: 60px;
    background-image: url('image, doesnt matter, looke the same anyways');
    border: 1px solid grey;
    border-radius: 3px;
    background-size: 100%;
    float: left;
}
1

3 Answers 3

1

You cam modify your code as follows:

<div id="upload_photo_form">
    <div>
        <p>Please choose a file to upload.</p>
        <input id="upload_file" type="file" /><br>
   </div>
   <div>
        <p>Which mode would you like to use?</p>
        <div id="upload_one"></div>
        <div id="upload_two"></div>
   </div>

</div>
 <div style="clear:both;"></div>
 <button id="upload_button">Upload</button>
Sign up to request clarification or add additional context in comments.

1 Comment

You are welcome. Best of luck with your project! Rgds,
1

Try this:

#upload_button{
    margin-top:10px;
    clear: both;
}

DEMO

You can also use:

display: block;

Comments

0

Try this if you want to do this just with CSS:

#upload_photo_form div {overflow: hidden}
#upload_button {clear: both; margin-top: 10px;}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.