HTML5 CSS Video Tag inside div - css

I im using bootstrap modal plugin that i want to put to background animated mp4 video...how can i put in modal that so that video is shows from top to bottom in modal dialog..i have this html code:
<div class="modal fade in" id="user" role="dialog" aria-hidden="false" style="display: block;">
<div class="modal-dialog modal-sm">
<!-- page videocontent -->
<video preload="auto" autoplay="autoplay" loop="loop" width="640" height="480">
<!-- video files -->
<source src="./vid/1.mp4" type="video/mp4">
<source src="./vid/1.webm" type="video/webm">
<source src="./vid/1.ogv" type="video/ogg">
</video>
<!-- modal content -->
<div class="modal-content">
<div class="modal-header">
<div class="modal-header-left">
<h3>Add User</h3>
<p>Enter username, password, bouquet, expire to create user:</p>
</div>
<div class="modal-header-right">
<i class="fa fa-user-pencil fa-2x"></i>
</div>
</div>
<!-- modal body -->
<div class="modal-body">
<form class="form-horizontal" role="form">
<!-- form username -->
<div class="form-group">
<label for="username" class="control-label">Username *</label>
<div class="col-sm-8">
<input type="text" class="form-control parsley-validated" id="username" parsley-trigger="change" parsley-required="true" parsley-minlength="4" parsley-validation-minlength="1">
</div>
</div>
<!-- form password -->
<div class="form-group">
<label for="password" class="control-label">Password *</label>
<div class="col-sm-8">
<input type="text" class="form-control parsley-validated" id="password" parsley-trigger="change" parsley-required="true" parsley-minlength="4" parsley-validation-minlength="1">
</div>
</div>
<!-- form mac -->
<div class="form-group">
<!-- label mac -->
<label for="mac" class="control-label">MAC</label>
<!-- input mac -->
<div class="col-sm-8">
<input type="text" class="form-control parsley-validated" id="mac" parsley-trigger="change" parsley-minlength="4" parsley-type="mac" parsley-validation-minlength="1">
</div>
</div>
<!-- form expire -->
<div class="form-group">
<!-- label expire -->
<label for="expire" class="control-label">Expire *</label>
<!-- input expire -->
<div class="col-sm-8" id="expire">
<select class="chosen-select chosen-transparent form-control parsley-validated" id="expire" parsley-trigger="change" parsley-required="true" parsley-error-container="#selectbox" style="display: none;">
<option value="">Please choose</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
</select><div class="chosen-container chosen-container-single chosen-container-single-nosearch" style="width: 0px;" title="" id="expire_chosen"><a class="chosen-single" tabindex="-1"><span>3</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" readonly=""></div><ul class="chosen-results"><li class="active-result result-selected" style="" data-option-array-index="0">Please choose</li><li class="active-result" style="" data-option-array-index="1">1</li><li class="active-result" style="" data-option-array-index="2">2</li><li class="active-result result-selected" style="" data-option-array-index="3">3</li><li class="active-result" style="" data-option-array-index="4">4</li><li class="active-result" style="" data-option-array-index="5">5</li></ul></div></div>
</div>
</div>
<!-- form bouquet -->
<div class="form-group">
<!-- label bouquet -->
<label for="bouquet" class="control-label">Bouquet *</label>
<!-- input bouquet -->
<div class="col-sm-8" id="bouquet">
<select class="chosen-select chosen-transparent form-control parsley-validated" id="bouquet" parsley-trigger="change" parsley-required="true" parsley-error-container="#selectbox" style="display: none;">
<option value="">Please choose</option>
<option value="1">BOUQUET1</option>
<option value="2">BOUQUET2</option>
<option value="3">BOUQUET3</option>
</select><div class="chosen-container chosen-container-single chosen-container-single-nosearch" style="width: 0px;" title="" id="bouquet_chosen"><a class="chosen-single" tabindex="-1"><span>BOUQUET4</span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off" readonly=""></div><ul class="chosen-results"><li class="active-result result-selected" style="" data-option-array-index="0">Please choose</li><li class="active-result" style="" data-option-array-index="1">Ex-Yu</li><li class="active-result" style="" data-option-array-index="2">Mega</li><li class="active-result result-selected" style="" data-option-array-index="3">MAG250 MEGA</li></ul></div></div>
</div>
</div>
<!-- form notes -->
<div class="form-group">
<!-- label notes -->
<label for="notes" class="control-label">Notes</label>
<!-- textbox notes -->
<div class="col-sm-8">
<textarea class="form-control parsley-validated" id="notes" rows="3" parsley-trigger="keyup" parsley-rangelength="[0,200]" parsley-validation-minlength="1"></textarea>
</div>
</div>
<!-- form options -->
<div class="form-group">
<!-- label options -->
<label class="control-label">Options</label>
<!-- checkbox options -->
<div class="col-sm" id="options">
<div class="checkbox check-transparent">
<input type="checkbox" value="1" id="adult" parsley-group="adult" parsley-trigger="change" parsley-required="true" parsley-mincheck="2" parsley-error-container="#adult .last" class="parsley-validated parsley-error">
<label for="adult">Adult</label>
</div>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<!-- modal-footer buttons -->
<div class="col-sm-8">
<button type="submit" class="btn btn-default">OK</button>
<button type="reset" class="btn btn-default cancel">Cancel</button>
</div>
</div>
</div>
</div>
i need to show video tag in modal-dialog modal-sm class so that video is displayed in whole modal, i set in video tag width: 640 and height 480 but it is shows only in modal-body class and i don't know how to expand whole video object to whole div object.

Try this:
add this to your CSS File:
.videoAdd {
position: absolute;
right: 0;
bottom: 0;
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
z-index: -100;
background-size: cover;
overflow: hidden;
}
and in HTML file try adding this Div and add the video tag inside it:
<div class="wrapper">
<video class="videoAdd">
<source src="yourVideoSrc" type="video/mp4">
<source src="anotherVideoSrc" type="video/ogg">
</video>
</div>

Related

CSS - Horizontal Inline Alignment

I'm developing a website (http://madworks.fr/suparis/fr/tuniques/14-syakati-tunic.html) and I'd like to align horizontally the "color" "size" "qtt" and "add to cart" button on one single line. I did my best to try modifying the display properties to inline or table-cell but that didn't work out.
Same for the social networks who should be aligned with the wishlist icon.
Can someone help me achieve that ?
Here's the source code :
<form id="buy_block" action="http://madworks.fr/suparis/fr/panier" method="post">
<!-- hidden datas -->
<p class="hidden">
<input type="hidden" name="token" value="58dbb67dab473715d793e92ac45eb820">
<input type="hidden" name="id_product" value="14" id="product_page_product_id">
<input type="hidden" name="add" value="1">
<input type="hidden" name="id_product_attribute" id="idCombination" value="68">
</p>
<div class="box-info-product">
<div class="content_prices clearfix">
<!-- prices -->
<div class="price_box clearfix">
<p class="our_price_display pull-left" itemprop="offers" itemscope="" itemtype="https://schema.org/Offer"><span id="our_price_display" itemprop="price" content="500">500,00 €</span><meta itemprop="priceCurrency" content="EUR"></p>
<p id="old_price" class=" hidden pull-left" style="display: none;"><span id="old_price_display" style="display: none;"></span></p>
</div> <!-- end prices -->
</div> <!-- end content_prices -->
<div class="product_attributes clearfix">
<!-- attributes -->
<div id="attributes">
<div class="clearfix"></div>
<fieldset class="attribute_fieldset">
<label class="attribute_label" for="group_1">Taille </label>
<div class="attribute_list">
<div class="selector" id="uniform-group_1" style="width: 96px;"><span style="width: 86px; -webkit-user-select: none;">S</span><select name="group_1" id="group_1" class="form-control attribute_select no-print">
<option value="1" selected="selected" title="S">S</option>
<option value="2" title="M">M</option>
</select></div>
</div> <!-- end attribute_list -->
</fieldset>
<fieldset class="attribute_fieldset">
<label class="attribute_label" for="group_3">Couleur </label>
<div class="attribute_list">
<div class="selector" id="uniform-group_3" style="width: 96px;"><span style="width: 86px; -webkit-user-select: none;">Noir</span><select name="group_3" id="group_3" class="form-control attribute_select no-print">
<option value="8" title="Blanc">Blanc</option>
<option value="11" selected="selected" title="Noir">Noir</option>
</select></div>
</div> <!-- end attribute_list -->
</fieldset>
</div> <!-- end attributes -->
<!-- availability or doesntExist -->
<div id="availability_statut" style="display: none;">
<span id="availability_value" class=" st-label-warning">This product is no longer in stock</span>
</div>
<div id="availability_date" style="display: none;">
<span id="availability_date_label">Availability date:</span>
<span id="availability_date_value"></span>
</div>
<!-- Out of stock hook -->
<div id="oosHook">
</div>
</div> <!-- end product_attributes -->
<div class="box-cart-bottom">
<!-- quantity wanted -->
<div class="qt_cart_box clearfix ">
<p id="quantity_wanted_p">
<span class="quantity_input_wrap clearfix">
-
<input type="text" min="1" name="qty" id="quantity_wanted" class="text" value="1">
+
</span>
</p>
<div id="add_to_cart_wrap" class="">
<p id="add_to_cart" class="buttons_bottom_block no-print">
<button type="submit" name="Submit" class="btn btn-medium btn_primary exclusive">
<span>Add to cart</span>
</button>
</p>
</div>
</div>
<!-- minimal quantity wanted -->
<p id="minimal_quantity_wanted_p" style="display: none;">
The minimum purchase order quantity for the product is <b id="minimal_quantity_label">1</b>
</p>
</div> <!-- end box-cart-bottom -->
</div> <!-- end box-info-product -->
</form>
Ideally you would reorder your HTML so that the 4 elements would be under the same parent element, like:
<div id="attributes">
<fieldset class="attribute_fieldset"></fieldset>
<fieldset class="attribute_fieldset"></fieldset>
<p id="quantity_wanted_p"></p>
<div id="add_to_cart_wrap"></div>
</div>
and they would have display: inline-block; on them, adjust any padding/spacing as necessary, etc.
But if that's not possible or too difficult, you could do it with this CSS:
.product_attributes, .attribute_fieldset, .box-cart-bottom {
display: inline-block;
}
You'll just be left with some padding and classes to adjust until you get it to one line. I would reference a CSS tutorial and look up things like padding, display, floats, etc. if you're having trouble.

twitter bootstrap modal is not coming properly on mobile screen

I have implemented modal as a pop up. On desktop its coming properly but on mobile screen its coming at the one corner and not fully also.
Code for modal
<div class="modal fade" id="loginmodal" role="dialog" style="display:none;position: fixed;top: 50%;left: 50%;margin-top: -15%;margin-left: -25%;margin-bottom: -50px;width:80%;height:80%;">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" style="background-color: #2E5D2E;">
<div class="modal-body">
<h1 class="cover-heading" style="text-shadow: -1px 1px 1px #0A0401;font-weight: 900;font-size: xx-large;">Pick Ur Desired Location</h1>
<h5 class="cover-heading" style="text-shadow: -1px 1px 1px #0A0401;">We will get back to you promptly.</h5>
<form id="loginform" name="loginform" method="get" action="/query" class="form-horizontal">
<div class="form-group">
<div class="col-sm-2 control-label" style="color: #0E0E0E;white-space: nowrap;" >
<label for="location" style="margin-left: 24px;">Your Location</label>
<div class="col-sm-10">
<select class="selectpicker form-control" id="location" name="location" style="width: 664%;" required="true">
<option value="jaipur" disabled="disabled" selected="selected">Jaipur</option>
<option value="shimla">Shimla</option>
<option value="bangalore">Bangalore</option>
</select>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-2 control-label" style="margin:auto; border-radius:0;color: #0E0E0E;">
<label for="username">Email Id:</label>
<div class="col-sm-10">
<input name="emailId" class="form-control" id="emailId" tabindex="1" type="email" required="true" style="width: 664%;"/>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-2 control-label" style="margin:auto; border-radius:0;color: #0E0E0E;">
<label for="username" style="margin-left: 5px;">Phone No:</label>
<div class="col-sm-10">
<input type="text" name="phoneno" id="phoneno" class="form-control ip_text" tabindex="2" style="width: 664%;" pattern="^([0-9]{10})?$" required="required"/>
</div>
</div>
</div>
<button type="submit" class="btn btn-success btn-block"> Submit Your Interest</button>
</form>
</div>
</div>
</div>
</div>
On mobile screen its looking like this
how Can I make it to come center of the screen with out disrupting its location on big screen like desktop. Can someone suggest me some idea to do it ?
The inline styles you're applying are causing alot of the issues (I removed any related to size-position) and you are putting your input and label inside col-sm-2 when you just want the label itself to use col-sm-2, not the input and label encased together inside of those columns.
<label for="location" class="col-sm-2 control-label" style="color: #0E0E0E;white-space: nowrap;">Your Location</label>
You can use jQuery to keep your modal on the center of the page.
See working example.
$(function() {
function reposition() {
var modal = $(this),
dialog = modal.find('.modal-dialog');
modal.css('display', 'block');
dialog.css("margin-top", Math.max(0, ($(window).height() - dialog.height()) / 2));
}
$('.modal').on('show.bs.modal', reposition);
$(window).on('resize', function() {
$('.modal:visible').each(reposition);
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet" />
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#loginmodal">Launch demo modal</button>
<div class="modal fade" id="loginmodal" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content" style="background-color: #2E5D2E;">
<div class="modal-body">
<h1 class="cover-heading" style="text-shadow: -1px 1px 1px #0A0401;font-weight: 900;font-size: xx-large;">Pick Ur Desired Location</h1>
<h5 class="cover-heading" style="text-shadow: -1px 1px 1px #0A0401;">We will get back to you promptly.</h5>
<form id="loginform" name="loginform" method="get" action="/query" class="form-horizontal">
<div class="form-group">
<label for="location" class="col-sm-2 control-label" style="color: #0E0E0E;white-space: nowrap;">Your Location</label>
<div class="col-sm-10">
<select class="selectpicker form-control" id="location" name="location" required="true">
<option value="jaipur" disabled="disabled" selected="selected">Jaipur</option>
<option value="shimla">Shimla</option>
<option value="bangalore">Bangalore</option>
</select>
</div>
</div>
<div class="form-group">
<label for="username" class="col-sm-2 control-label" style=" border-radius:0;color: #0E0E0E;">Email Id:</label>
<div class="col-sm-10">
<input name="emailId" class="form-control" id="emailId" tabindex="1" type="email" required="true" />
</div>
</div>
<div class="form-group">
<label for="username" class="col-sm-2 control-label" style=" border-radius:0;color: #0E0E0E;">Phone No:</label>
<div class="col-sm-10">
<input type="text" name="phoneno" id="phoneno" class="form-control ip_text" tabindex="2" pattern="^([0-9]{10})?$" required="required" />
</div>
</div>
<button type="submit" class="btn btn-success btn-block">Submit Your Interest</button>
</form>
</div>
</div>
</div>
</div>

Twitter Bootstrap - form in Modal formatting - ASP.NET

I have a form in a modal that formats perfectly if the main window is not too wide (with the labels above the fields). However, if the browser is maximised or large enough it alters the layout of the contents inside the modal so that the labels are now to the left of the fields (which means one word per line and looks very messy).
Any idea how I have overcome this behavior so that the class form-horizontal is working to the width of the modal, not the browser window?
Update with code:
Here is the structure of the modal
<div id="CCNewModal" class="modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button class="close" aria-hidden="true" type="button" data-dismiss="modal">×</button>
<h4 id="CCTitle" runat="server" class="modal-title">New Credit Card</h4>
</div>
<div class="modal-body">
<div>
<fieldset>
<div id="selectCardDiv" class="form-group">
<label id="selectCardLabel" class="col-lg-2 control-label" for="selectCard">Card Type</label>
<div class="col-lg-10">
<select class="form-control" id="selectCard" runat="server">
<option value="0">Select Card</option>
<option value="Amex">Amex</option>
<option value="MasterCard">MasterCard</option>
<option value="Visa">Visa</option>
</select>
</div>
</div>
<div id="selectNameDiv" class="form-group">
<label id="selectNameLabel" class="col-lg-2 control-label" for="inputCCName">Name</label>
<div class="col-lg-10">
<input class="form-control" id="inputCCName" runat="server" type="text" placeholder="Name (as on statement)">
</div>
</div>
<div id="selectNumberDiv" class="form-group">
<label id="selectNumberLabel" class="col-lg-2 control-label" for="inputCCNumber">Number</label>
<div class="col-lg-10">
<input class="form-control" id="inputCCNumber" runat="server" type="text" placeholder="Credit Card Number (no spaces)">
</div>
</div>
<div id="selectMonthDiv" class="form-group">
<label id="selectMonthLabel" class="col-lg-2 control-label" for="selectMonth">Expiry Month</label>
<div class="col-lg-10">
<select class="form-control" id="selectMonth" runat="server">
<option value="0">Month</option>
<option value="01">Jan</option>
<option value="02">Feb</option>
<option value="03">Mar</option>
<option value="04">Apr</option>
<option value="05">May</option>
<option value="06">Jun</option>
<option value="07">Jul</option>
<option value="08">Aug</option>
<option value="09">Sep</option>
<option value="10">Oct</option>
<option value="11">Nov</option>
<option value="12">Dec</option>
</select>
</div>
</div>
<div id="selectYearDiv" class="form-group">
<label id="selectYearLabel" class="col-lg-2 control-label" for="selectYear">Expiry Year</label>
<div class="col-lg-10">
<select class="form-control" id="selectYear" runat="server"></select>
</div>
</div>
<div id="selectCVVDiv" class="form-group">
<label id="selectCVVLabel" class="col-lg-2 control-label" for="inputCVV">CVV</label>
<div class="col-lg-10">
<input class="form-control" id="inputCVV" runat="server" type="text" placeholder="Security Code (CVV)">
</div>
</div>
<div id="selectBillingAddressDiv" class="form-group">
<label id="selectBillingAddressLabel" class="col-lg-2 control-label" for="inputBillingAddress">Billing Address</label>
<div class="col-lg-10">
<textarea class="form-control" id="inputBillingAddress" runat="server" rows="3" placeholder="Address as on Statement"></textarea>
</div>
</div>
<div id="selectBillingCityDiv" class="form-group">
<label id="selectBillingCityLabel" class="col-lg-2 control-label" for="inputCCCity">City</label>
<div class="col-lg-10">
<input class="form-control" id="inputCCCity" runat="server" type="text" placeholder="City">
</div>
</div>
<div id="selectBillingStateDiv" class="form-group">
<label id="selectBillingStateLabel" class="col-lg-2 control-label" for="selectState">State</label>
<div class="col-lg-10">
<select class="form-control" id="selectState" runat="server">
<option value="0">Select State</option>
<option value="AL">Alabama</option>
<option value="AK">Alaska</option>
<option value="AZ">Arizona</option>
<option value="AR">Arkansas</option>
<option value="CA">California</option>
<option value="CO">Colorado</option>
<option value="CT">Connecticut</option>
<option value="DE">Delaware</option>
<option value="DC">District of Columbia</option>
<option value="FL">Florida</option>
<option value="GA">Georgia</option>
<option value="HI">Hawaii</option>
<option value="ID">Idaho</option>
<option value="IL">Illinois</option>
<option value="IN">Indiana</option>
<option value="IA">Iowa</option>
<option value="KS">Kansas</option>
<option value="KY">Kentucky</option>
<option value="LA">Louisiana</option>
<option value="ME">Maine</option>
<option value="MD">Maryland</option>
<option value="MA">Massachusetts</option>
<option value="MI">Michigan</option>
<option value="MN">Minnesota</option>
<option value="MS">Mississippi</option>
<option value="MO">Missouri</option>
<option value="MT">Montana</option>
<option value="NE">Nebraska</option>
<option value="NV">Nevada</option>
<option value="NH">New Hampshire</option>
<option value="NJ">New Jersey</option>
<option value="NM">New Mexico</option>
<option value="NY">New York</option>
<option value="NC">North Carolina</option>
<option value="ND">North Dakota</option>
<option value="OH">Ohio</option>
<option value="OK">Oklahoma</option>
<option value="OR">Oregon</option>
<option value="PA">Pennsylvania</option>
<option value="RI">Rhode Island</option>
<option value="SC">South Carolina</option>
<option value="SD">South Dakota</option>
<option value="TN">Tennessee</option>
<option value="TX">Texas</option>
<option value="UT">Utah</option>
<option value="VT">Vermont</option>
<option value="VA">Virginia</option>
<option value="WA">Washington</option>
<option value="WV">West Virginia</option>
<option value="WI">Wisconsin</option>
<option value="WY">Wyoming</option>
</select>
</div>
</div>
<div id="selectBillingZipDiv" class="form-group">
<label id="selectBillingZipLabel" class="col-lg-2 control-label" for="inputCCZip">Zip / Postcode</label>
<div class="col-lg-10">
<input class="form-control" id="inputCCZip" runat="server" type="text" placeholder="City">
</div>
</div>
<div class="form-group">
<label class="col-lg-2 control-label" for="inputCCCountry">Country</label>
<div class="col-lg-10">
<input disabled="" value="United States" class="form-control" id="inputCCCountry" runat="server" type="text" placeholder="City">
</div>
</div>
<div id="selectTelephoneDiv" class="form-group">
<label id="selectTelephoneLabel" class="col-lg-2 control-label" for="inputCCTelephone">Telephone</label>
<div class="col-lg-10">
<input class="form-control" id="inputCCTelephone" runat="server" type="text" placeholder="Telephone (format as 123-456-7890)">
</div>
</div>
<div class="checkbox">
<label>
<input id="selectPrimaryCB" runat="server" type="checkbox" checked>Primary (default) card</label>
</div>
</fieldset>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-default" type="button" data-dismiss="modal">Close</button>
<button id="CreditCardSaveButton" runat="server" class="btn btn-primary" type="button">Save</button>
</div>
</div>
</div>
</div>
and the following CCS override
#CCNewModal .modal-body {
max-height: 420px;
overflow-y: auto;
}
Master page is basically - the page I am working on fits into the MainContent placeholder
<form runat="server" class="form-horizontal">
<div class="container body-content">
<asp:ContentPlaceHolder ID="MainContent" runat="server">
</asp:ContentPlaceHolder>
<hr />
<footer>
<asp:Label ID="FooterLabel" runat="server" Font-Size="Small"></asp:Label>
</footer>
</div>
</form>
This is what the form looks like using form-vertical
..and it really does a number with the modal formatting
.. using form-horizontal (wide and narrow)
Can I override this behavior so that the class form-horizontal is working to the width of the modal, not the browser window?
In short, No. The styles for form-horizontal are based on media queries run against the size of the window. Media queries cannot be run against the size of other elements. Of course, you can use javascript to figure out the size of other elements and change other elements accordingly, but you'd lose all the native performance benefits of using plain old CSS and letting the browser do the work.
If the browser is maximised or large enough it alters the layout of the contents inside the modal so that the labels are now to the left of the fields
But that's exactly what horizontal forms do. If you don't want that kind of functionality, why don't you change it to a basic form? It sounds like, even if this wasn't space constrained by the modal window, this form would run into trouble if you have long label names and not enough column width to display them on a single line.
Here's an example of a Horizontal Form in a Modal
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModalHorizontal">
Launch Horizontal Form
</button>
<!-- Modal -->
<div class="modal fade" id="myModalHorizontal" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<button type="button" class="close"
data-dismiss="modal">
<span aria-hidden="true">×</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">
Modal title
</h4>
</div>
<!-- Modal Body -->
<div class="modal-body">
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="col-sm-2 control-label"
for="inputEmail3">Email</label>
<div class="col-sm-10">
<input type="email" class="form-control"
id="inputEmail3" placeholder="Email"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"
for="inputPassword3" >Password</label>
<div class="col-sm-10">
<input type="password" class="form-control"
id="inputPassword3" placeholder="Password"/>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox"/> Remember me
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Sign in</button>
</div>
</div>
</form>
</div>
<!-- Modal Footer -->
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">
Close
</button>
<button type="button" class="btn btn-primary">
Save changes
</button>
</div>
</div>
</div>
</div>
Here's an example of a basic form that maintains it's structure at all screen sizes:
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModalNorm">
Launch Normal Form
</button>
<!-- Modal -->
<div class="modal fade" id="myModalNorm" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<button type="button" class="close"
data-dismiss="modal">
<span aria-hidden="true">×</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">
Modal title
</h4>
</div>
<!-- Modal Body -->
<div class="modal-body">
<form role="form">
<div class="form-group">
<label for="exampleInputEmail1">Email address</label>
<input type="email" class="form-control"
id="exampleInputEmail1" placeholder="Enter email"/>
</div>
<div class="form-group">
<label for="exampleInputPassword1">Password</label>
<input type="password" class="form-control"
id="exampleInputPassword1" placeholder="Password"/>
</div>
<div class="checkbox">
<label>
<input type="checkbox"/> Check me out
</label>
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div>
<!-- Modal Footer -->
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">
Close
</button>
<button type="button" class="btn btn-primary">
Save changes
</button>
</div>
</div>
</div>
</div>
Alternatively, you could try to override some of the styles that .form-horizontal applies if you don't have much control over the markup. You could add some CSS like this (depending on the structure of your horizontal form)
.modal-body .form-horizontal .col-sm-2,
.modal-body .form-horizontal .col-sm-10 {
width: 100%
}
.modal-body .form-horizontal .control-label {
text-align: left;
}
.modal-body .form-horizontal .col-sm-offset-2 {
margin-left: 15px;
}
Horizontal Form with CSS
.modal-body .form-horizontal .col-sm-2,
.modal-body .form-horizontal .col-sm-10 {
width: 100%
}
.modal-body .form-horizontal .control-label {
text-align: left;
}
.modal-body .form-horizontal .col-sm-offset-2 {
margin-left: 15px;
}
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModalHorizontal">
Launch Horizontal Form
</button>
<!-- Modal -->
<div class="modal fade" id="myModalHorizontal" tabindex="-1" role="dialog"
aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<!-- Modal Header -->
<div class="modal-header">
<button type="button" class="close"
data-dismiss="modal">
<span aria-hidden="true">×</span>
<span class="sr-only">Close</span>
</button>
<h4 class="modal-title" id="myModalLabel">
Modal title
</h4>
</div>
<!-- Modal Body -->
<div class="modal-body">
<form class="form-horizontal" role="form">
<div class="form-group">
<label class="col-sm-2 control-label"
for="inputEmail3">Email</label>
<div class="col-sm-10">
<input type="email" class="form-control"
id="inputEmail3" placeholder="Email"/>
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"
for="inputPassword3" >Password</label>
<div class="col-sm-10">
<input type="password" class="form-control"
id="inputPassword3" placeholder="Password"/>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<div class="checkbox">
<label>
<input type="checkbox"/> Remember me
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Sign in</button>
</div>
</div>
</form>
</div>
<!-- Modal Footer -->
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">
Close
</button>
<button type="button" class="btn btn-primary">
Save changes
</button>
</div>
</div>
</div>
</div>
Here's a Demo in jsFiddle

CQ5 parsys leaves some space even in preview mode?

In edit mode we can see all parsys right, and In preview mode CQ shows us how the page would look in Publish instance. I have a page in which I have hardcoded my textfields and I have used parsys for entering Text (Labels ) on the page ...
But when I enter the preview mode the parsys leaves some space which makes my UI look bad.
Please see the images below.
How do I remove this extra space ?
I think I'm close to solving it ... I think a class in bootstrap CSS is adding the space its not the Parsys anyways here is the code
<%--
Videojet Add New User Component
--%>
<%#include file="/libs/foundation/global.jsp"%>
<%# page
import="com.videojet.hiresite.beans.HRRepresentative,
java.util.*"%>
<%
List<HRRepresentative> hrList = (List<HRRepresentative>)request.getAttribute("hrList");
%>
<cq:include script="head.jsp" />
<html>
<head>
<cq:includeClientLib css="videojetlib" />
<cq:includeClientLib css="customcarousel" />
<cq:includeClientLib css="bootstrapold" />
<link rel="shortcut icon" type="image/ico"
href="/content/dam/videojet/favicon.ico" />
</head>
<body>
<div class="navbar navbar-inverse navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<button type="button" class="btn btn-navbar" data-toggle="collapse"
data-target=".nav-collapse">
<span class="icon-bar"></span> <span class="icon-bar"></span> <span
class="icon-bar"></span>
</button>
<a class="brand" href="#"><img
src="/content/dam/videojet/Videojet-Logo.png"></img></a>
<div class="nav-collapse collapse">
<p class="navbar-text pull-right">
<a href="/services/videojet/v1/LoginController/logout"
class="navbar-link">Logout</a>
</p>
<ul class="nav">
<li class="active"><a
href="/services/videojet/v1/AddNewUserController/view">Add
New User</a></li>
<li><a
href="/services/videojet/v1/EditDeleteUsersController/view">Edit
/ Delete User</a></li>
<li><a
href="/services/videojet/v1/EditMyInformationController/view">Edit
My Information</a></li>
<li>Upload Documents</li>
</ul>
</div>
<!--/.nav-collapse -->
</div>
</div>
</div>
<!-- Adding above new Top navigation -->
<div style =" padding-bottom: 20px;">
<div class="container shadow">
<div class="span11">
<cq:include path="carouselparsys"
resourceType="foundation/components/parsys" />
</div>
<div class="row span11">
<form class="form-horizontal"
action="/services/videojet/v1/AddNewUserController/addUser"
method="POST" enctype="multipart/form-data" id ="addNewUserForm">
<input type="hidden" name="flagField" id="flagField" value="0"/>
<div class="row span11">
<div class="control-group">
<label class="control-label" for="inputEmail"><cq:include path="zensarParsys" resourceType="foundation/components/parsys"/></label>
<div class="controls">
<input type="text" id="addNewUserUID" name="addNewUserUID"
class="input-xlarge" style="height: 30px;">
</div>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">First Name</label>
<div class="controls">
<input type="text" id="addNewUserFirstName"
name="addNewUserFirstName" class="input-xlarge"
style="height: 30px;">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Last Name</label>
<div class="controls">
<input type="text" id="addNewUserLastName"
name="addNewUserLastName" class="input-xlarge"
style="height: 30px;">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Email
Address</label>
<div class="controls">
<input type="text" id="addNewUserEmailId"
name="addNewUserEmailId" class="input-xlarge"
style="height: 30px;">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">HR
Representative</label>
<div class="controls">
<select class="input-xlarge" id="addNewUserHRRep"
name="addNewUserHRRep">
<c:forEach items="${hrList}" var="hr">
<option value="${hr.repId}">${hr.firstName}
${hr.lastName}</option>
</c:forEach>
</select>
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Non-Compete
Letter</label>
<div class="controls">
<input type="file" id="addNewUserNonCompeteLetter"
name="addNewUserNonCompeteLetter" style="height: 30px;">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Offer
Letter</label>
<div class="controls">
<input type="file" id="addNewUserOfferLetter"
name="addNewUserOfferLetter" style="height: 30px;">
</div>
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Employee
Type</label>
<div class="controls">
<label class="checkbox inline"> <input type="radio"
id="addNewUserLocal" name="addNewUserType" checked="checked" value="1">
Local
</label> <label class="checkbox inline"> <input type="radio"
id="addNewUserField" name="addNewUserType" value="2">
Field
</label> <label class="checkbox inline"> <input type="radio"
id="addNewUserInternational" name="addNewUserType" value="3">
International
</label>
<label class="checkbox inline"> <input type="radio"
id="addNewUserInternational" name="addNewUserType" value="4">
Admin
</label>
</div>
<!-- the Div that brings them in line !!! -->
</div>
<div class="control-group">
<label class="control-label" for="inputPassword">Special
Intructions</label>
<div class="controls">
<textarea rows="3" class="input-xlarge" id="addNewUserTextArea"
name="addNewUserTextArea"></textarea>
</div>
</div>
<div class="control-group">
<div class="control-label">
<button type="submit" class="btn btn-primary">Add User</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div id="footer">
<cq:include path="addNewUserVideojetFooter"
resourceType="foundation/components/parsys" />
</div>
<cq:includeClientLib js="videojetlib" />
<cq:includeClientLib js="customcarousel" />
<cq:includeClientLib js="bootstrapold" />
<!-- modal -->
<div id="usderIdCheckModal" class="modal hide fade" tabindex="-1"
role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"
data-backdrop="static">
<div class="modal-header">
<h3 id="myModalLabel">Checking if User Id is available</h3>
</div>
<div class="modal-body" align="center">
<div align="center">
<img src="/content/dam/videojet/ajax-loader.gif"></img>
</div>
<p>Please Wait...</p>
</div>
</div>
<!-- Second Modal -->
<!-- modal -->
<div id="notAvailableModal" class="modal hide fade" tabindex="-1"
role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h3 id="myModalLabel">Warning</h3>
</div>
<div class="modal-body" align="center">
<div align="center">
</div>
<p>This User Id already exists</p>
</div>
</div>
<script src="/etc/designs/videojet/clientlibs/js/addNewUserScript.js"></script>
</body>
</html>
Maybe there is a style rule in the drag components like visible: hidden; change to display: none
Well I solved it my self. The problem was with bootstrap. The extra space was added by bootstrap class="control-group", I just replaced it with class="row".
There is still little space but at least better than before.
You should be able to add ?wcmmode=disabled to the end of your browser address bar to remove extra spacing.

CSS form with side by side fields...how to align the labels and fields vertically?

completely frustrated here with something that is probably so simple. I have a form and want the Zip and Zip+4 fields to be on the same line. For some reason nothing is lining up the way I've done it. I've spent the last 6 hours searching the web and trying various things (this latest was from this site) and nothing works. Can someone help me please? Thanks!
Here is my code:
<form>
<div style="float:left;">
<label for "StrAddress">Street Address *</label>
<input name="StrAddress" type="text" style="width:200px" id="StrAddress" />
</div>
<div style="clear:both;"> </div>
<div style="float:left;">
<label for "StrSecondaryAddress">Suite, P.O. Box, Apt, Lot</label>
<input name="StrSecondaryAddress" type="text" style="width:200px" id="StrSecondaryAddress" />
</div>
<div style="clear:both;"> </div>
<div style="float:left;">
<label for "StrCity">City *</label>
<input name="StrCity" type="text" class="autosuggestinput" style="width:200px" id="StrCity" />
</div>
<div style="clear:both;"> </div>
<div style="float:left;">
<label for "subject">State</label>
<input type="text" class="input_text" name="subject" id="subject"/>
</div>
<div style="clear:both;"> </div>
<div style="display: inline;;">
<label for "IntZip5">Zip *</label>
<input name="IntZip5" type="text" style="width:100px" id="IntZip5" />
<label for "IntZip4">Zip+4</label>
<input type="text" name="IntZip4" id="IntZip4" style="width:50px">
</div>
<div style="clear:both;"> </div>
<div style="float:left;">
<label for "IntAmount">Taxable Amount</label>
<input type="text" name="IntAmount" id="IntAmount" style="width:150px">
</div>
<div style="clear:both;"> </div>
<input type="button" class="button" value="Submit Form" />
</form>
Would this do the job for you? Please test it on multiple browsers
because it's only tested on FF 3.6, IE 7+
While the structure police are sure to pull me over for this, it is my considered opinion that using a table is the single most reliable way to line up elements in all browsers. Set the vertical-align:top and do what you need to do.
You can do something along this lines:
<html>
<head>
<style type="text/css">
* { padding: 0; margin: 0;} /* do not use universal selector this is just for example */
label {
width: 300px !important;/* added important to override your inline styles*/
display: block !important;
text-align: right !important;
float: left;
}
</style>
</head>
<body>
<form>
<div style="float:left;">
<label for "StrAddress">Street Address *</label>
<input name="StrAddress" type="text" style="width:200px" id="StrAddress" />
</div>
<div style="clear:both;"> </div>
<div style="float:left;">
<label for "StrSecondaryAddress">Suite, P.O. Box, Apt, Lot</label>
<input name="StrSecondaryAddress" type="text" style="width:200px" id="StrSecondaryAddress" />
</div>
<div style="clear:both;"> </div>
<div style="float:left;">
<label for "StrCity">City *</label>
<input name="StrCity" type="text" class="autosuggestinput" style="width:200px" id="StrCity" />
</div>
<div style="clear:both;"> </div>
<div style="float:left;">
<label for "subject">State</label>
<input type="text" class="input_text" name="subject" id="subject"/>
</div>
<div style="clear:both;"> </div>
<div style="display: inline;;">
<label for "IntZip5">Zip *</label>
<input name="IntZip5" type="text" style="width:100px" id="IntZip5" />
<label for "IntZip4">Zip+4</label>
<input type="text" name="IntZip4" id="IntZip4" style="width:50px">
</div>
<div style="clear:both;"> </div>
<div style="float:left;">
<label for "IntAmount">Taxable Amount</label>
<input type="text" name="IntAmount" id="IntAmount" style="width:150px">
</div>
<div style="clear:both;"> </div>
<input type="button" class="button" value="Submit Form" />
</form>
</body>
</html>
The code you posted shows zip and zip+4 on the same line for me in Firefox, Chrome, and IE. Can you post a screen shot of how you see it differently and how you want it to look?

Resources