i am trying to create a modal box, here is my html
<div id="sign_up_box"> // this should be transparent
<div id="signup_form"> // this should be opaque
<button type="button">X Close</button>
<form method="POST" action="signup_pro.php">
<label>Name</label></br>
<input type="text" name="username"/></br>
<label>Email</label></br>
<input type="email" name="email"/></br>
<label>Password</label></br>
<input type="password" name="password"/></br>
<input type="submit" value="Create Account"/>
</form>
</div>
</div>
here is my css
#sign_up_box {
position:absolute;;
top:0%;
left:0%;
bottom:0%;
right:0%;
width:100%;
height:100%;
background-color: crimson;
opacity:0.5;
display:none;
transition: opacity 400ms ease-in;
}
#signup_form {
position:absolute;
top:30%;
left:40%;
z-index:9999;
opacity:1 !important;
background-color:white;
width:30%;
min-width:100px;
padding:2px;
}
#signup_form form{
margin:5% auto;
width:80%;
opacity:1;
}
I have div inside another div, i want outer div to be transparent but inner div to be totally opaque.
but here i am unable to override the the parents opacity property as a result the inner div is transparent as well. can anyone suggest a solution? jsfiddle - http://jsfiddle.net/manu2784/z5qrwfgv/
try taking the form out of the backdrop. As in:
<div id="sign_up_box">// this should be transparent</div>
<div id="signup_form">// this should be opaque
<button type="button">X Close</button>
<form method="POST" action="signup_pro.php">
<label>Name</label>
</br>
<input type="text" name="username" />
</br>
<label>Email</label>
</br>
<input type="email" name="email" />
</br>
<label>Password</label>
</br>
<input type="password" name="password" />
</br>
<input type="submit" value="Create Account" />
</form>
</div>
Fiddle: http://jsfiddle.net/oxfuc4et/1/
(I took out display:none from the css only for demo purposes, I believe you will be doing that on button click yourself, right?)
Take this out display:nonefiddle
I think the problem is
display:none
Are you trying something like this
Related
I have styled this code block while using Google chrome and as you see in this image it aligns fine.
However when viewing it with Firefox it doesn't display correctly
What am I doing wrong?
.full-panel select {
-webkit-appearance:none;
background-color:#1B6B80;
background-position:95% 50%;
background-repeat:no-repeat;
border:1px solid #1B6B80;
border-radius:2px;
color:#FFFFFF;
display:block;
font-size:10px;
height:30px;
line-height:10px;
padding-left:5px;
padding-right:25px;
position:absolute;
right:150px;
top:30px;
width:150px;
}
<form method="POST" action="/" accept-charset="UTF-8"><input name="_token" type="hidden" value="M7sQaw7MVFV4DQhoyMxdiuJPB7E5KbaWVB5U9lbp">
<div class="full-panel">
<input name="quick" value="1" type="hidden">
<input class="biginput" type="text" name="name" placeholder="Set up your free website">
<select name="domain_id">
<option>mysite.com</option>
</select>
<input class="bigbutton" type="submit" value="Submit">
</div>
</form>
When you have to use the position absolute be sure that its parent container has a relative position
.full-panel {
position:relative;
}
This way you can start counting the pixels (top:30px) relatively to its container and NOT relatively to body
I have tried googling but with no help most of them give solution as margin:auto
and also there are several questions on stackoverflow with same problem most of them have answer as margin:auto i am applying the same solution is not working for me
HTML
<div id="content" class="lcard">
<center>
<h1 class="n">Sign in To your<br> Crawler Account</h1><br>
<form onsubmit="return validateForm()" method="post">
<center><input name="Email" required type="email" placeholder="Email">
<input name="Password" required type="Password" placeholder="Password" >
<button type="submit" class="b"><b>Sign In</b></button>
</center>
<p id="reg" ><a href="C:/lcrawl/register.html" >New User Please Register</a></p>
</form>
</div>
CSS
.lcard
{
background-color:#EEEEEE;
height:400px;
width:400px;
margin:left;
}
.n
{
margin-bottom:50;
left:-50%;
}
input
{
padding: 5 10px;
width:274px;
height:44px;
margin:auto;
}
.b
{
border: 1px solid;
background-color:#3079ed;
width:274px;
height:44px;
margin:auto;
}
Why you are giving margin left here??
.lcard
{
background-color:#EEEEEE;
height:400px;
width:400px;
margin:left;
}
First thing I noticed is the margin: left which I'm not sure about if it's a real value or not.
You should also check the attributes within your input elements. Types and other values seem strange, try to mess around with them first and then try using input[type="text"] and input[type="submit"] in the CSS values, instead of just **input.
Put your center tag before the first div as you call the id content
<div id="content" class="lcard">
<center>
<h1 class="n">Sign in To your<br> Crawler Account</h1><br>
<form onsubmit="return validateForm()" method="post">
<center><input name="Email" required type="email" placeholder="Email">
<input name="Password" required type="Password" placeholder="Password" >
<button type="submit" class="b"><b>Sign In</b></button>
</center>
<p id="reg" ><a href="C:/lcrawl/register.html" >New User Please Register</a></p>
</form>
</div>
should be...
<center>
<div id="content" class="lcard">
<h1 class="n">Sign in To your<br> Crawler Account</h1><br>
<form onsubmit="return validateForm()" method="post">
<center><input name="Email" required type="email" placeholder="Email">
<input name="Password" required type="Password" placeholder="Password" >
<button type="submit" class="b"><b>Sign In</b></button>
<p id="reg" ><a href="C:/lcrawl/register.html" >New User Please Register</a></p>
</form>
</div>
</center>
First, remove OLD OLD center blocks, than just apply text-align: center to form and to header. JSFiddle
.n
{
text-align: center;
}
I changed ur css a little
.lcard
{
background-color:#EEEEEE;
height:400px;
width:400px;
margin-left: auto;
margin-right: auto;
}
Now It's work in my PC.
Nothing's wrong with your code
Here is jsfiddle, with your code plus minor modification
http://jsfiddle.net/Lb6mm/2/
I have two queries as stated below:-
1) I want to move the blue colored rectangular box (containing username and password text fields) to the center of the page. I tried using   to change the location of the rectangular box but strange, it is not moving at all.Is there any parameter in HTML which can help me shift this box to the center of the page? Can anyone suggest me how can I achieve this?
2) The BORDER = 8 parameter is not working as here I want to set a dark black colored border around my rectangular box. Can anyone suggest what can be the cause of this issue?
To replicate the issue which I am facing, copy the below codes in a .TXT file and save it as .HTML file. Open in IE or Firefox browser to see the issue which I am getting.
Code:
<html>
<form id="login" action="index.html">
<div style="width: 450px; height: 250px; background: blue;BORDER=8"><br/><br/><br/>
<strong>Username: </strong> <input type="text" name="userid" size="18" maxlength="18"/><br/> <br/>
<strong>Password : </strong> <input type="password" name="pswrd" size="18" maxlength="18"/> <br/><br/><br/>
<input type="submit" value="Submit">
<input type="reset" value="Cancel" onclick="myFunction()" value="Reset form"/>  
</div><br/><br/>
</form>
</html>
if you only want to center horizontally try with: margin:0 auto;
http://jsfiddle.net/P2rQK/
<div style="width: 450px; height: 250px; background: blue;margin:0 auto;">
<form id="login" action="index.html">
<strong>Username: </strong> <input type="text" name="userid" size="18" maxlength="18"/>
<strong>Password : </strong> <input type="password" name="pswrd" size="18" maxlength="18" />
<input type="submit" value="Submit" />
<input type="reset" value="Cancel" onclick="myFunction()" value="Reset form" />
</form>
</div>
It is bad to use to position elements. also <br /> is not a "clean" way.
If you want truly dynamic positioning, use the below which is not reliant on specifying dimensions. Critically it uses a CSS tabulated layout to do the position calculations. The border can be achieved by giving your form a border:8px solid black;
You should also move your styles out from being specified inline- and use CSS to control your layout instead of reliance on so much HTML (such as ).
Demo Fiddle
HTML
<div class='table'>
<div class='cell'>
<form id="login" action="index.html">
<label>Username:</label>
<input type="text" name="userid" size="18" maxlength="18" />
<br />
<label>Password :</label>
<input type="password" name="pswrd" size="18" maxlength="18" />
<br />
<input type="submit" value="Submit" />
<input type="reset" value="Cancel" onclick="myFunction()" value="Reset form" />
</form>
</div>
</div>
CSS
html, body {
height:100%;
width:100%;
margin:0;
padding:0;
}
label {
font-weight:bold;
margin-right:10px;
}
.table {
display:table;
text-align:center;
width:100%;
height:100%;
table-layout:fixed;
}
.cell {
display:table-cell;
vertical-align:middle;
}
form {
display:inline-block;
border:8px solid black;
width: 450px;
padding:50px 0;
background: blue;
}
input {
margin-bottom:15px;
}
although this is not a js-question:
<div style="position: absolute; left: 50%; margin-left: 225px; width: 450px; height: 250px; background: blue; border: 8px solid black"> content </div>
position absolute, left 50% and margin-left: -225px (half width) will position the box in the middle of the screen.
border: 8px solid black is the right way to define a border of 8px width
You will need to add margin: 0 auto; to your blue box.
Look at this Demo
<div style="border-width:8px;border-color:red;border-style:solid;width:450px;height:1050px;background-color:gold;"> content </div>
I would advise using a lot more CSS and less use of the and <br>.
` <html>
<style>
#login {
left: 50%;
width: 200px;
margin-left: -225px;
position: relative;
}
div {
width: 450px;
height: 250px;
background: blue;
border:8px solid #000;
padding:20px;
}
</style>
<form id="login" action="index.html">
<div>
<strong>Username: </strong> <input type="text" name="userid" size="18" maxlength="18"/><br>
<strong>Password : </strong> <input type="password" name="pswrd" size="18" maxlength="18"/><br>
<input type="submit" value="Submit"><br>
<input type="reset" value="Cancel" onclick="myFunction()" value="Reset form" />
</div>
</form>
</html>`
Try playing around with margins to get the positioning correct.
I created a jfiddle. I'm sure it is easy to fix, but I can't figure it out.
http://jsfiddle.net/mt4jK/8/
<h1 class="allpages">Questions or Concerns about Compliance Issues?</h1>
<h3>We welcome all compliments and constructive criticism!</h3>
<form class="webform" action="http://hsc.unm.edu/scripts/cfmailform/cfmailer.cfm" method="post">
<!--Required hidden operators-->
<input name="recipient" type="hidden" value="bfloran#salud.unm.edu" />
<input name="subject" type="hidden" value="HSC Compliance Office Email Form" />
<input type="hidden" name="cc" value="mgwilson#salud.unm.edu" />
<input name="redirect" type="hidden" value="http://hsc.unm.edu/admin/compliance/ThankYOU.html" /> <!-- Field validation for the user -->
<label for "name">Your Name (optional):</label>
<input name="name" type="text" id="name" value="" /><br />
<label for "name">Your E-mail (Optional):</label>
<input name="mail" type="text" value="" /><br>
<label for "name">Comment:</label>
<textarea name="comment" value="" ></textarea>
<p>
<div class="submit">
<input type="submit" value="Submit" />
<input type="reset" value="Reset" />
</div>
</form>
CSS:
h3{text-align:center;}
.webform {background-color: #eeeeee;
width: 655px; border: solid;
border-color: #e9e9e9;margin-left: auto; margin-right: auto; padding: 15px 0px 15px 17px;}
.webform label { width:200px; vertical-align:top; text-align:right; padding: 5px; float:left; font-size:14px; font-weight:bold;}
.webform textarea {width:200px; text-align:right; float:left; }
.submit{width:50px:}
edit: formatting the CSS code to easy visibility.
you have a float:left in textarea remove it like this:
.webform textarea {width:200px; text-align:right; }
instead of this:
.webform textarea {width:200px; text-align:right; float:left; }
DEMO
It looks like the margin-bottom of your comment boxes is messing with the .submit div. I found that adding some margin top to your .submit wrapper pushes it far enough down to clear the other container's margin-bottom. Try adding this to your ".submit" class:
css:
width: 230px;
margin: 50px auto;
I have some text in a link "title" and also a form box and I want the text on the left and the form on the right. However, whenever I try to do this what comes out is the line of text and then the form appears BELOW the text. I want them on the same horizontal line.
So I want with the dots: TEXT ................................. SIGN IN BOX
here is the code:
<div id="container">
<a href="index.php"><font size="6">Title</font><a>
<div id="topnav" class="topnav"> Have an account? <a href="login" class="signin">
<span>Sign in</span></a> </div>
<fieldset id="signin_menu">
<form method="post" id="signin">
<p>
<label for="username">Username or email</label>
<input id="username" name="username" value="" title="username" tabindex="4" type="text">
</p>
</form>
</fieldset>
</div>
Here is the CSS for the container:
#container {
margin:0 auto;
position:relative;
width:780px;
}
and topnav
#topnav {
font-size:11px;
line-height:23px;
padding:10px 0 12px;
text-align:right;
}
How do I accomplish the task? Thanks
DIV is a block element so will always do that. You need to make it a non-block element by setting float and display.
Besides the solution below you could use a table but that is frowned upon.
<div id="container">
<div class="titleDiv"><a href="index.php"><font size="6">Title</font><a></div>
<div id="topnav" class="topnav"> Have an account? <a href="login" class="signin">
<span>Sign in</span></a>
<fieldset id="signin_menu">
<form method="post" id="signin">
<p>
<label for="username">Username or email</label>
<input id="username" name="username" value="" title="username" tabindex="4" type="text">
</p>
</form>
</fieldset></div>
</div>
Then set your CSS to this:
#topnav {
font-size:11px;
line-height:23px;
padding:10px 0 12px;
text-align:right;
float:left; display:inline;
}
.titleDiv
{
float:left; display:inline;
}
so you want div.topnav appear on the left of the a ? Easiest would be to replace div with a non-block element such as span... otherwise see float css style