default css parameters for form and div html elements - html

Quick question:
I am trying to reengineer a mailchimp pop up. There is a form element that is centered on the document, I'd like to convert it to a div element (simply to replace "form" with "div"). Problem is when I do, it is no longer centered.
Clearly there are differences in the default css for each of these two elements, what are they?
It isn't "display:block"
Thanks
<style type="text/css">
#mc_embed_signup{position:absolute; top:0; left:0; width:100%; height:100%; background-color:rgba(0,0,0,.8); z-index:10000; }
#mc_embed_signup form{position:fixed; top:10%; left:50%; width:50%; margin-left:-17%; font:normal 100% Helvetica,Arial,sans-serif; font-size:14px; border-radius:4px; border:none; padding:0; background-color:#fff; color:#000; text-align:left; overflow-y:auto; overflow-x:hidden; }
#mc_embed_signup a.mc_embed_close{ cursor:pointer; }
#mc-embedded-subscribe .button{ margin:0; padding:0; }
</style>
<script type="text/javascript">
$(document).ready(function(){
$("#mc_embed_close").click(function(){
$("#mc_embed_signup").hide();
});
alert($("#mc-embedded-subscribe-form").css('display'));
});
</script>
<div id="mc_embed_signup">
<form id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate style="width:500px; height:500px; background-repeat:no-repeat; background-position:center;">
<div class="mc-field-group">
<div style="position:relative">
<a href="/support">
<img src="/images/pop-ups/summer-drive-button.png" style="position:absolute; top:350px; border:1px dotted #ccc" />
</a>
<img src="/images/pop-ups/summer-drive.jpg" />
</div>
</div>
<a id="mc_embed_close" class="mc_embed_close" style="position:absolute; top:5px; right:10px;">×</a>
<div class="clear"></div>
<div id="mce-responses" class="clear">
<div class="response" id="mce-error-response" style="position:absolute; top:0; left:0; display:none"></div>
<div class="response" id="mce-success-response" style="width:300px; position:absolute; background-color:#FFF; top:30px; left:75px; display:none"></div>
</div>
</form>
</div>

The default style for a form differs depending on the browser and the rendering mode, but it's just a block element with some margin or padding.
Your CSS specifies position:fixed for the form element, and places it in the center of the window. If you exchange the form element for a div, you have to change the CSS so that it applies to the div instead. You probably want to add a class to the div so that you can target it specifically.

Related

how can i fit search text field and search button in div(div A) where div (div A) is in another div(div B) which has 100% width

[i want to do like this]
[1]: https://i.stack.imgur.com/OOSKk.png
I have created a div(div B) in body that has 100% width and it has another div (div A) which has two components in it.the Div A is not able to get width of only two elements its getting 100% width.
This is my code
<div id="con"> <div id="srbt"> <input id="srch" type="text" placeholder="Paste Youtube link" name="search"> <button id="btn">Download</button></div> </div>
* {
box-sizing: border-box;
}
#con {
display:block;
background: #502c6c;
height:125px;
width:100%;
padding:30px;
}
#srbt {
width:100%;
background: #ffffff;
height:65px;
border-radius:5px;
position:relative;
}
#srch {
display:block;
width:100%;
border:none;
height:65px;
border-radius:5px;
padding:0 20% 0 5%;
line-height:65px;
color:#6c7592;
font-size:20px;
}
#btn {
background:#ff5916;
border:none;
border-radius:5px;
height:59px;
width:20%;
position:absolute;
top:3px;
right:3px;
z-index:10;
color:#ffffff;
font-size:24px;
}
<div id="con">
<div id="srbt">
<input id="srch" type="text" placeholder="Paste Youtube link" name="search">
<button id="btn">Start</button>
</div>
</div>

position:relative set on editable dropdown is displaying over header of web page when scroll down

Here is my Html code for setting header and editable drop down
<div class="header" style="position:fixed; width:100%;">
<div class="container-fluid" id="continer1ForProjectContext">
<div class="row-fluid">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"><a>img style="margin-left:10%; margin-top:0.3%;" ></a>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="form-group has-success" style="margin-left:30%;">
<div class="select-editable" id="select2">
<select ng-options="item.label for item countryValues track by item.id" ng-model="selectedCountry">
<input type="text" name="Country" value="select" ng-model="selectedProject.label" id="txtProject" required />
</div>
</div>
</div>
</div>
and here is the CSS which i used
#continer1ForProjectContext{
background-color: #009530;
color: #959696;
height: 65px;
}
.select-editable {
background-color:white;
width:120px;
height:18px;
position:absolute;
}
.select-editable select {
top:0px;
left:0px;
font-size:14px;
border:solid #3c763d 1px;
width:170px;
margin:0;
height:30px;
border-radius: 5px 5px 5px 5px;
position:absolute;
}
.select-editable input {
bottom:0
width:150px;
padding:1px;
font-size:12px;
border:solid #3c763d 1px;
border-bottom:none;
height:29px;
border-radius: 5px 0px 0px 5px;
position:absolute;
}
.select-editable select:focus, .select-editable input:focus {
outline:none;
}
I want the header to be fixed which is done but at the same time when i scroll down the page the editable combo box is visible over the header. what is the problem??? any help is appriciable!!!
This 'problem' is caused because position: absolute; and position: fixed; take an element out of the document flow. To make sure your 'layers' of elements are in the correct order on the z-axis, you can use z-index.
A good read with a little more information is found here.

Position absolute css is not working in input tag

hi the problem is that i have given position absolute to a input but i just find that absolute position is not working in input tag can anyone know?
i just wanna my layout liquid by positioning that's why i use this
here is my Html code:
<div id="savevalue">
<input type="text" name="name" id="name" class="inpt" />
<input type="button" value="Submit" class="btn" />
</div>
and here is css code:
.inpt{
background:#fff;
border:1px solid #ccc;
height:30px;
font-size:18px;
position:absolute;
left:0;
right:100px;
}
.btn{
height:30px;
background:#333;
border:1px solid #222;
font-size:18px;
color:#fff;
padding:0 15px;
position:absolute;
right:0;
}
yes it works fine by using
width: -moz-available
thanks to every one

hide table behind div

I want to make a table which isn't editable under certain conditions, so I want to overlay it with a div.
Why is this not working?
CSS
<style type="text/css">
#div_tabel_basisgegevens {
background-color: red;
float:left;
position:relative;
left:0px;
top:0px;
z-index:120;
width:750;
height:100px;
}
#tabel_basisgegevens {
height:100px;
color:white;
position:relative;
left:0px;
top:0px;
z-index:2;
}
</style>
HTML
<div id="div_tabel_basisgegevens">
<table id="tabel_basisgegevens">
<tr>
<td>
<input type="Checkbox" id="geen_periodes" />
</td>
</tr>
</table>
</div>
Wrap the div and table with another div. Give the parent div position:relative;. Give the overlay div opacity:0;position:absolute;width:100%;height:100%;
<style type="text/css">
#div_tabel_basisgegevens{
background-color: red;
float:left;
position:absolute;
left:0px;
top:0px;
z-index:120;
width:100%;
height:100%;
opacity:0;
}
#tabel_basisgegevens{
height:100px;
color:white;
left:0px;
top:0px;
z-index:2;
background:red;
}
#wrapper {position:relative;}
</style>
<div id="wrapper">
<div id="div_tabel_basisgegevens"></div>
<table id="tabel_basisgegevens">
<tr><td><input type="Checkbox" id="geen_periodes"></td></tr>
</table>
</div>
http://jsfiddle.net/RZQwb/2/
And as Nerd-Herd mentioned, if all you want to do is make an input field non-editable, the correct method is to add the disabled attribute ( disabled="disabled" for XHTML)

CSS min-height does not adjust background color and border

I'm having problems with this site I am building. I need a fixed width so that I can do margin-left and margin-right auto (center the form item on my 'left window'. Problem is that I'm trying to make this code modular so that it will work with any future forms I decide to create as well, meaning I need a variable height, depending on how many fields a form will need.
so to clarify the above statement, I'm trying to keep the fixed width and have a variable height (using min-height). The problem is that the background color and div border are not shrinking or expanding along with the div size. any ideas?
the site is here: http://traelid.com/news/createNews.php
here is my form code and my CSS code:
FORM:
<script type='text/javascript' src='../nicEdit/nicEdit.js'></script>
<script type='text/javascript'>
bkLib.onDomLoaded(function() {nicEditors.allTextAreas() });
</script>
<div class='frmcontainer'>
<div class='title'>TraeLid News</div>
<div class='fill'>
<div class='row'>
<div class='frm lbl'>
<label for='author'>Author:</label>
</div>
<div class='frm itm'>
Auto Author
</div>
</div>
<div class='row'>
<div class='frm lbl'>
<label for='subject'>Subject:</label>
</div>
<div class='frm itm'>
<input class='itm itmtxt' type='text' name='subject' />
</div>
</div>
<div class='row'>
<div class='frm lbl'>
<label for='content'>Content:</label>
</div>
<div class='frm itm txtarea' style='background-color:#fff;'>
<textarea class='itm itmtxtarea ckeditor' name='content'></textarea>
</div>
</div>
<div class='row'>
<div class='frm lbl'>
<label for='tags'>Tags:</label>
</div>
<div class='frm itm'>
<input class='itm itmtxt' type='text' name='tags' />
</div>
</div>
</div>
</div>
CSS:
.frmcontainer
{
text-align:center;
width:750px;
min-height:200px;
margin-left:auto;
margin-right:auto;
border-radius:10px;
border-width:1px;
border-style:solid;
}
.frm
{
margin:5px;
}
.title
{
clear:both;
width:750px;
margin-bottom:24px;
font-size:28px;
font-weight:bold;
text-decoration:underline;
font-variant:small-caps;
}
.row
{
width:750px;
height:auto;
float:left;
clear:both;
}
.lbl
{
font-size:18px;
font-weight:bold;
text-align:left;
height:30px;
width:150px;
float:left;
}
/*Container and input styles*/
.itm
{
text-align:left;
height:25px;
width:580px;
float:left;
}
.itmtxt
{
width:576px;
border-style:solid;
border-width:1px;
}
.txtarea
{
height:400px;
}
.itmtxtarea
{
width:578px;
height:343px;
border-style:solid;
border-width:1px;
}
.nicEdit-panel
{
background-color: #eee;
}
.nicEdit-selected
{
background-color: #fff;
word-wrap:break-word;;
overflow:hidden;
}
.nicEdit-main
{
word-wrap:break-word;
overflow:hidden;
max-height:343px;
}
on .frmcontainer add overflow: hidden;. fiddle ex