Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8961341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T15:52:08+00:00 2026-06-15T15:52:08+00:00

I have a div that creates a border with css and what I want

  • 0

I have a div that creates a border with css and what I want to do is show a form when a user clicks the button.

HTML form:

<div class="dropshadow-add">
    <h3>Add</h3>
        <button class="addwebcam">Add</button>
        <button class="addaxiscam">Add Another</button>

    <div id="cameraformwebcam" title="Add a webcam">
    <form id='AddCameraFormWebcam' name='' method='post' action=''>
        <label for="CameraName">Camera name:&nbsp;</label>
        <input id="CameraName" name="camera_name" size="24" maxlength="36" value="Enter label for camera" />
        <label for='CameraQuality'>Camera quality:&nbsp;</label>
        <select id='CameraQuality' name='camera_quality'>
            <option value='HIGH' selected='selected'>High</option>
            <option value='MEDIUM'>Medium</option>
            <option value='MOBILE'>Mobile</option>
        </select>
...
        <button type='submit' class='submit_camera' name='addcamera' value='Add'>Add</button>
        <button type='button' class='cancel_changes' name='cancel_changes' value='Cancel'>Cancel</button>
    </form>
    </div>
<div id="cameraformaxis" title="Add an Axis camera">
    <form id='AddCameraFormAxis' name='' method='post' action=''>
        <label for="CameraName">Camera name:&nbsp;</label>
        <input id="CameraName" name="camera_name" size="24" maxlength="36" value="Enter label for camera" />
        <label for='CameraQuality'>Camera quality:&nbsp;</label>
        <select id='CameraQuality' name='camera_quality'>
            <option value='HIGH' selected='selected'>High</option>
            <option value='MEDIUM'>Medium</option>
            <option value='MOBILE'>Mobile</option>
        </select>
...
        <button type='submit' class='submit_camera' name='addcamera' value='Add'>Add</button>
        <button type='button' class='cancel_changes' name='cancel_changes' value='Cancel'>Cancel</button>
    </form>
    </div>
    </div>

jQuery code to show/hide the form on click:

jQuery('#cameraformwebcam').hide();
jQuery('#cameraformaxis').hide();

jQuery('.addwebcam').click(function(e) {
    jQuery('#cameraformwebcam').show();
    jQuery('#cameraformaxis').hide();
});

jQuery('.addaxiscam').click(function(e) {
    jQuery('#cameraformaxis').show();
    jQuery('#cameraformwebcam').hide();
});

Finally, my problem is the CSS code:

#AddCameraFormWebcam label,#AddCameraFormAxis label,
#AddCameraFormWebcam input,#AddCameraFormAxis input,
#AddCameraFormWebcam select,#AddCameraFormAxis select,
#AddCameraFormWebcam textarea,#AddCameraFormAxis textarea{
  display: block;
  float: left;
  width: 200px;
  margin-bottom: 1em;
  margin-top: 0.5em;
}
#AddCameraFormWebcam select,#AddCameraFormAxis select{
  width: 100px;
}
#AddCameraFormWebcam label,#AddCameraFormAxis label {
  clear: both;
  color: black;
  width: 120px;
  padding-right: 8px;
  text-align: left;
  white-space: nowrap;
}
#AddCameraFormWebcam label.error,#AddCameraFormAxis label.error {
  float: none;
  color: red;
}
#AddCameraFormWebcam button[type="button"],#AddCameraFormAxis button[type="button"]{
  float: right;
  width: 100px;
  margin-left: 10px;
  margin-top: 5px;
}
#AddCameraFormWebcam button[type="submit"],#AddCameraFormAxis button[type="submit"] {
  float: right;
  width: 100px;
  margin-top: 5px;
}
#AddCameraFormWebcam button[name="cancel_changes"],#AddCameraFormAxis button[name="cancel_changes"] {
  clear: both;
}
#AddCameraFormWebcam button[name="camera_status"] + label,#AddCameraFormAxis button[name="camera_status"] + label {
  clear: none;
}


.dropshadow-add {
 -moz-border-radius: 5px;
 border-radius: 5px;
 -moz-box-shadow: 5px 5px 5px #ccc;
 -webkit-box-shadow: 5px 5px 5px #ccc;
 box-shadow: 5px 5px 5px #ccc;
 width:    400px;
 padding:15px 15px 15px 15px;
 margin-bottom:15px;
 margin-left:15px;
 margin-right:15px;
 background-color:#ffffff;
 border: 1px solid #CCCCCC;
 padding: 1px 15px 15px 15px;
}

See this fiddle to play around.

Click a button and you will see that form goes outside the div. How can I keep it in the div? If I change the buttons and the labels to float: inherit it does work but then the formatting is messed up. I want to put the form in the div and the buttons should be on the right (add button, then cancel button next to each other). Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T15:52:09+00:00Added an answer on June 15, 2026 at 3:52 pm

    Replace your CSS with this

    #AddCameraFormWebcam label,#AddCameraFormAxis label, 
    #AddCameraFormWebcam input,#AddCameraFormAxis input, 
    #AddCameraFormWebcam select,#AddCameraFormAxis select, 
    #AddCameraFormWebcam textarea,#AddCameraFormAxis textarea{
        display: block;
        width: 200px;
        margin-bottom: 1em;
        margin-top: 0.5em;
    }
    #AddCameraFormWebcam select,#AddCameraFormAxis select{
        width: 100px;
    }
    #AddCameraFormWebcam label,#AddCameraFormAxis label {
        clear: both;
        color: black;
        width: 120px;
        padding-right: 8px;
        text-align: left;
        white-space: nowrap;
    }
    #AddCameraFormWebcam label.error,#AddCameraFormAxis label.error {
        float: none;
        color: red;
    }
    #AddCameraFormWebcam button[type="button"],#AddCameraFormAxis button[type="button"]{
        width: 100px;
        margin-left: 10px;
        margin-top: 5px;
    }
    #AddCameraFormWebcam button[type="submit"],#AddCameraFormAxis button[type="submit"] {
        float: right;
        width: 100px;
        margin-top: 5px;
    }
    #AddCameraFormWebcam button[name="cancel_changes"],#AddCameraFormAxis button[name="cancel_changes"] {
        clear: both;
    }
    #AddCameraFormWebcam button[name="camera_status"] + label,#AddCameraFormAxis button[name="camera_status"] + label {
        clear: none;
    }
    
    
    .dropshadow-add {
      -moz-border-radius: 5px;
      border-radius: 5px;
      -moz-box-shadow: 5px 5px 5px #ccc;
      -webkit-box-shadow: 5px 5px 5px #ccc;
      box-shadow: 5px 5px 5px #ccc;
      width:    400px;
      padding:15px 15px 15px 15px; 
      margin-bottom:15px;
      margin-left:15px;
      margin-right:15px;
      background-color:#ffffff;
      border: 1px solid #CCCCCC;
      padding: 1px 15px 15px 15px;
    }​
    

    Fiddle: http://jsfiddle.net/K6FwH/2/

    1.

    #AddCameraFormWebcam label,#AddCameraFormAxis label,
    #AddCameraFormWebcam input,#AddCameraFormAxis input,
    #AddCameraFormWebcam select,#AddCameraFormAxis select,
    #AddCameraFormWebcam textarea,#AddCameraFormAxis textarea{
      display: block;
      float: left;
      width: 200px;
      margin-bottom: 1em;
      margin-top: 0.5em;
    }
    

    Remove float: left;

    2.

    #AddCameraFormWebcam button[type="button"],#AddCameraFormAxis button[type="button"]{
      float: right;
      width: 100px;
      margin-left: 10px;
      margin-top: 5px;
    }
    

    Remove float: right; and margin-left: 10px;

    Fiddle: http://jsfiddle.net/K6FwH/2/

    If you want to keep the buttons right aligned

    Fiddle: http://jsfiddle.net/enve/K6FwH/3/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a button that creates paragraphs dynamically in a div along with an
In my extension, I have a content script that creates a <div> containing an
I have a div that is created by Ajax with .append(html) function, I'm trying
I have a script that create a new div element. Then, I want to
I currently have a tab image that I want to re-create in CSS, but
I have items and buttons that are created dynamically and I want to show
I have created a div there are two childs of that div one is
I have created some JQuery that will expand a div 'popup' on hover and
I have a div that expands to the height of it's content. It works
I have a div that I click on to drag it. Once it's on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.