css messed up (auto height) [closed] - html

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 years ago.
Improve this question
I have a problem with a css style. It happen when I set height to auto website
access live view by diung this go to newproject.comli.com/post.php log in with a username = shining password = asdfgh123 and then manualy go to newproject.comli.com/details.php
so my div height gets set to 0 do not know why. I am talking about #itemsCategListsform could someone help me? Here is my code:
<div id="itemsCategListsform">
<div id="plink">
<div id="open">My details</div>
<div id="closed">My ads</div>
<div id="closed">Favorites</div>
</div>
<div id="pbase">
<div id="detailforms">
<p> Email:
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<input type="email" name="email" size="30">
<input class="submit-buttonform" type="submit" name="updateemail" value="Update Email">
</form>
</p>
<p>
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
Password: <br>
<input type="password" name="password" size="30"><br>
Re-Password: <br>
<input type="password" name="repassword" size="30">
<input class="submit-buttonform" type="submit" name="updatepassword" value="Update password" >
</form>
</p>
Phone:
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<input type="text" name="phone" size="30">
<input class="submit-buttonform" type="submit" name="updatephone" value="Update phone">
</form>
Website:
<form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post">
<input type="text" name="website" size="30">
<input class="submit-buttonform" type="submit" name="updatewebsite" value="Update website">
</form>
</div>
</div>
</div>
and css :
#itemsCategListsform {
background-color: white;
position: relative;
width: 930px;
height: auto;
left: 175px;
top: 20px;
border-radius: 4px;
border: 1px solid #1a171a;
padding-top: 40px;
padding-left: 70px;
-webkit-box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.6);
-moz-box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.6);
box-shadow: 3px 3px 5px 0px rgba(0,0,0,0.6);
}
#plink {
position: relative;
width: 200px;
float: left;
border-top: 1px solid black;
border-left: 1px solid black;
z-index: 10;
border-radius: 4px 0 0 4px;
-webkit-box-shadow: -3px 3px 5px -3px rgba(0,0,0,0.6);
-moz-box-shadow: -3px 3px 5px -3px rgba(0,0,0,0.6);
box-shadow: -3px 3px 5px -3px rgba(0,0,0,0.6);
}
#open {
border-bottom: 1px solid black;
border-right: 1px solid #fbfbfe;
text-align: center;
line-height: 50px;
background-color: #fbfbfe;
}
#closed {
border-bottom: 1px solid black;
width: 200px;
text-align: center;
line-height: 50px;
}
#pbase {
border: 1px solid black;
background-color: #fbfbfe;
position: relative;
width: 600px;
height: auto;
float: left;
margin-left: -1px;
border-radius: 0px 4px 4px 4px;
-webkit-box-shadow: -3px 3px 5px -3px rgba(0,0,0,0.6);
-moz-box-shadow: -3px 3px 5px -3px rgba(0,0,0,0.6);
box-shadow: 3px 3px 5px -3px rgba(0,0,0,0.6);
}
#closed:hover a {
display: block;
background-color: #fbfbfe;
border-right: 1px solid black;
}
#open:hover a {
display: block;
}
#detailforms {
position: relative;
margin:0 auto;
top: 10px;
width: 450px;
height: auto;
margin-bottom: 40px;
}

The height is registering as 0 because the child element is floated. CSS float takes an element out of the flow of content and wraps inline elements around it.
Your problem is here:
<div id="itemsCategListsform">
<div id="plink">
...
#plink{ float: left; }
#phase{ float: left; }
I'd recommend adding a pseudo element after the parent with clear: both set.
<div id="itemsCategListsform" class="clearfix">
<div id="plink">
...
.clearfix:after {
content: " ";
display: block;
height: 0;
clear: both;
}
See some additional solutions here.

Add display: inline-block to the css of itemsCategListsform :)

okay with a help of DACrosby was solved easily as he said that because of float left and to solve that i just add overflow: auto; tell me if i did good or there is better solution cuz this was really easy and seems to be okay everything

Related

Input not clickable

.contact-form {
transition: .3s;
margin-top: 120px;
/*border: 2px solid black;*/
background-color: rgb(243, 243, 243);
border-radius: 6px;
box-shadow: -4px 12px 11px 5px rgba(0, 0, 0, 0.521);
width: 475px;
height: 550px;
margin-left: 11px;
text-align: left;
align-items: center;
position: sticky;
left: 60%;
top: -20%;
user-select: all;
z-index: 4;
}
.benefit-card {
margin: 20px;
background-color: white;
text-align: center;
border: 1px solid black;
width: 300px;
height: 450px;
top: 0%;
left: 22%;
box-shadow: 2px 2px 12px 2px black;
user-select: none;
}
.benefit-card-header {
border-bottom: 3px dotted black;
padding-bottom: 11px;
}
.benefit-card-image {
-webkit-user-drag: none;
padding-top: 11px;
padding-bottom: 19px;
width: 200px;
filter: drop-shadow(2px 2px 6px black);
}
#help-me {
position: relative;
z-index: 8;
margin-top: -515px;
}
<div class="contact-form">
<h2 class="contact-form-header">Get Your Quote Today!</h2>
<form class="form-bg-pls-send-help">
<label class="contact-input-header" for="email">Email<span class="important-contact-field"> *</span></label>
<br>
<input class="contact-input" name="email" type="email" autocomplete="off" required placeholder="Your company email" />
<label class="contact-input-header" for="company">Company</label>
<br>
<input class="contact-input" name="company" type="text" required placeholder="Who do you work for?" />
<label class="contact-input-header" for="subject">Subject</label>
<input class="contact-input" name="subject" type="text" placeholder="Subject " />
<label class="contact-input-header" for="about">About</label>
<textarea class="long-input contact-input" name="about" type="text" placeholder="What does your company do?"></textarea>
<br><br>
<input class="getquote-button" type="submit" value="Get Quote" />
</form>
</div>
<div id="help-me">
<div class="benefit-card" id="bc">
<h1 class="benefit-card-header" id="bch">World Wide</h1>
<h3 class="benefit-card-description" id="bcd">No matter where you're from or where you're located we will help you grow your company!</h3>
</div>
</div>
I am building a sample website of a company. I have a contact form set up, but the inputs are not clickable when they are in a div tag, but I need the form in one so I can properly style the form.
The form is supposed to require the input, when I click on the Get Quote button it allows me to edit the first input tag. This has never happened to me before and I have tried user-select, checking if the disabled attribute was used, and just about everything I can think of.
Update your css file to:
#help-me{
position: relative;
z-index: -1;
margin-top: -515px;
}
This element is covering the whole screen.
Update the z-index when you need to show it.
Your inputs are not clickable because #help-me covers all of .contact-form due to the way you have used margin-top to position it higher compared to where it would naturally sit.
Consider using flexbox to achieve your layout instead.
.layout {
display: flex
}
.contact-form {
flex: 1 1 auto;
background-color: rgb(243, 243, 243);
border-radius: 6px;
box-shadow: -4px 12px 11px 5px rgba(0, 0, 0, 0.521);
}
#help-me {
flex: 1 1 auto;
}
<div class="layout">
<div id="help-me">
#help-me
</div>
<div class="contact-form">
.contact-form
</div>
</div>

Centering Textbox inside Div Tag

I am trying to center my text box within the div. I have searched and tried. I even tried centering the input box alone with a margin of 0 but had no such luck. Please help.
Here is the JS Fiddle I made to aid with helping. Also there is a strange white space at the bottom. Please see the fiddle. Thanks a lot.
HTML:
<footer>
<div class="footerContainer">
<div class="footerLeft">
<h3>CONTACT US</h3>
<br />
<form name="contact" action="">
<table cellpadding="10">
<tr>
<td>
<label for="name" id="name_label"></label>
</td>
<td>
<input type="text" name="name" id="name" size="50" value="" class="text-input" placeholder="Your Name"/>
<label class="error" for="name" id="name_error"><br />This field is required.</label>
</td>
</tr>
<tr>
<td>
<label for="email" id="email_label"></label>
</td>
<td>
<input type="text" name="email" id="email" size="50" value="" class="text-input" placeholder="Your Email"/>
<label class="error" for="email" id="email_error"><br />This field is required.</label>
</td>
</tr>
<tr>
<td>
<label for="comment" id="comment_label"></label>
</td>
<td>
<textarea name="comment" id="comment" rows="8" cols="50" placeholder="Your Message"/></textarea>
<label class="error" for="comment" id="comment_error"><br />This field is required.</label>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" name="submit" class="button" id="submit_btn" value="Submit" />
</td>
</tr>
</table>
</form>
</div>
<div class="footerRight">
<h3>CABRINI REPERTORY THEATRE</h3>
<sub>701 Fort Washington Avenue</sub>
<br />
<h3>Get Social</h3>
<br />
<span class="fa fa-facebook fa-3x"></span> <span class="fa fa-twitter fa-3x"></span> <span class="fa fa-vimeo-square fa-3x"></span> <span class="fa fa-instagram fa-3x"></span>
</div>
</div>
</footer>
CSS:
footer{
width: 100%; min-height: 375px;
background-color: #3772ab;
border-top: 3px solid #1f3e5f;
padding: 30px;
color: #FFF;
}
footer .footerContainer{
width: 80%; height: 325px;
margin: 0 auto;
border: 3px solid #F00;
}
footer .footerLeft{
width: 45%;
padding: 0 10px 0 0;
margin: 0 10px 0 0;
float: left;
display: inline-block;
border: 3px solid #F00;
}
footer .footerRight{
width: 45%;
padding: 0 0 0 10px;
margin: 0 0 0 10px;
float: right;
display: inline-block;
border: 3px solid #F00;
}
#media screen and (max-width: 1225px) {
footer{
min-height: 500px;
width: 100%;
text-align:center;
margin: 0 auto;
border: 3px solid #F00;
}
footer .footerLeft{
width: 100%;
display: block;
color: #fff;
margin: 0 0 30px 0;
padding: 0;
border: 3px solid #F00;
float: none;
}
footer input[type=text], footer textarea{
display: block;
margin : 0 auto;
position:relative;
border: 3px solid #F00;
}
footer .footerRight{
width: 100%;
display: block;
margin: 0;
border: 3px solid #F00;
float: none;
}
}
footer input[type=text], footer textarea{
-webkit-box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
-moz-box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
padding: 10px;
background: #fff;
margin: 0 0 10px 0;
}
You need to add text-align: center to parent in this case I have added it to td
And remove display: block of footer input[type=text], footer textarea
Check this
td {
text-align: center
}
footer input[type=text], footer textarea{
/*display: block;*/}
Hey there #SavionSmith
I reformed the form by getting rid of tables and using a list, it's much easier and cleaner (try to avoid tables).
HTML:
<footer>
<div class="footerContainer">
<form name="contact" action="">
<div class="footerLeft">
<h2>CONTACT US</h2>
</div>
<ul >
<li id="li_1" >
<label class="description" for="name"> Field Required </label>
<div>
<input id="name" name="name" class="text-input" placeholder="Your Name" type="text" maxlength="255" value=""/>
</div>
</li> <li id="li_2" >
<label class="description" for="email"> Field Required </label>
<div>
<input id="email" name="email" class="text-input" placeholder="Your Email" type="text" maxlength="255" value=""/>
</div>
</li> <li id="li_3" >
<label class="description" for="comment">Field Required </label>
<div>
<textarea id="comment" name="comment" class="element textarea medium" placeholder="Your Message" ></textarea>
</div>
</li>
<li class="buttons">
<input style="border: none;width: auto;" class="button" id="submit_btn" type="submit" name="submit" value="Submit" />
</li>
</ul>
</form>
</div>
</footer>
CSS:
form textarea,
form input { width: 50%; }
form ul
{
font-size:100%;
list-style-type:none;
margin:0;
padding:0;
width:100%;
}
form li
{
display:block;
margin:0;
padding:4px 5px 2px 9px;
position:relative;
}
.buttons
{
clear:both;
display:block;
margin-top:10px;
}
h2, h3, label
{
text-align: center;
display: block;
}
form {
margin: 0 auto;
}
input, textarea
{
border: solid #ef2;
display: block;
margin: 0 auto;
}
footer{
background-color: #3772ab;
border-top: 3px solid #1f3e5f;
padding: 30px;
color: #FFF;
}
footer .footerContainer{
margin: 0 auto;
border: 3px solid #F00;
}
footer .footerLeft{
border: 3px solid #F00;
}
footer .footerRight{
width: 45%;
padding: 0 0 0 10px;
margin: 0 0 0 10px;
border: 3px solid #F00;
}
#media screen and (max-width: 1225px) {
footer{
min-height: 500px;
text-align:center;
margin: 0 auto;
border: 3px solid #F00;
}
footer .footerLeft{
color: #fff;
border: 3px solid #F00;
}
footer input[type=text], footer textarea{
display: block;
margin : 0 auto;
border: 3px solid #F00;
}
footer .footerRight{
display: block;
border: 3px solid #F00;
}
}
footer input[type=text], footer textarea{
-webkit-box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
-moz-box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
box-shadow:
inset 0 0 8px rgba(0,0,0,0.1),
0 0 16px rgba(0,0,0,0.1);
background: #fff;
}
JSFiddle: http://jsfiddle.net/Jhb9q/10/
The form will keep re-sizing while the browser window changes size!
The form input { width: 50%; } controls the width size of the inputs except the submits button because I tried to exclude it using style="border: none;width: auto;" in its tag.
Also I tried to make the text a little bit more flexible.
You can change the design using CSS as you want, Hope this helps!

Making my form responsive according the sprites

I can use all the help with making my contact form responsive according the eagle sprite I have on this page: http://demo.chilipress.com/epic3/
The idea is to have the eagle's mouth over the form while the screen gets resized.
As you can see, the sprites are completely responsive and so is the form. However the form does not stick to the eagle's mouth when resizing.
HTML:
<section id="two" class="window">
<img src="assets/contact.jpg" alt="background image">
<div id="sprite1_contact"></div>
<div id="sprite2_contact"></div>
<div id="content">
<div class="contact">
<form>
<fieldset class="name group">
<label for="name" class="name">Name</label>
<input id="name" name="name" required aria-required=”true” pattern="[A-Za-z-0-9]+\s[A-Za-z]+" title="firstname lastname"/>
</fieldset>
<fieldset class="email group">
<label for="email" class="email">Email</label>
<input type="email" id="email" name="email" required title="Submit a valid Email">
</fieldset>
<fieldset class="phone group">
<label for="phone" class="phone">Telephone</label>
<input type="tel" id="phone" name="phone" pattern="(\+?\d[- .]*){7,17}" required title="Submit an international, national or local phone number"/>
</fieldset>
<fieldset class="message group">
<label class="message">Message</label>
<input type="text" id="message" required/>
</fieldset>
<fieldset class="send group">
<input type="submit" value="Send" class="sendButton">
</fieldset>
</form>
</div>
</div>
</section>
CSS
#sprite1_contact{
background-image: url('sprite_contact2.png');
width: 35.2%;
height: 0;
padding-bottom: 7%;
background-position: 0 0;
background-size: 100%;
display: block;
top: 0;
position: absolute;
margin: 0 0 0 32.3%;
z-index: 2;}
#sprite2_contact {
background-image: url('sprite_contact2.png');
width: 27.5%;
height: 0;
padding-bottom: 29%;
background-position: 0 27%;
background-size: 100%;
display: block;
top: 0;
position: absolute;
margin: 0 0 0 35.8%;
z-index: 1;}
#content{
max-width: 50.694%;
position: absolute;
bottom: 0;
background: none repeat scroll 0 0 rgba(0, 0, 0, .55);
border-radius: 13px;
width: 678px;
margin: 0 0 7.6% 25.9167%;
box-shadow: 0 0 0 2px #000000, 2px 2px 30px 1px rgba(199, 255, 100, 0.73);}
.contact{
width: 100%;
margin: 10px;}
fieldset{
border: 0;
margin: 0;
width: 100%;
padding: 1%;}
.name, .email, .message{
padding-right: 29px;}
label{
color: #d8d9de;
font-family:'apple_chancerychancery';
font-size: 1.2em;
padding-left: 10px;}
input{
margin-right: 50px;
padding: 5px;
text-align: left;
border-radius: 10px;
background: none repeat scroll 0 0 rgba(255, 240, 260, 0.5);}
#name, #email, #phone, #message{
float: right;
color: #253c93;
text-decoration: none;
border: 1px dotted #29FF00;
font-family: 'Calibri', Arial, sans-serif;
font-size: 1em;
width: 73%;}
#name{
width: 73.5%;}
textarea {vertical-align: top;}
div#inner-editor{
padding: 30px;}
#message{
padding-top: 10%;}
.sendButton{
background: rgba(0, 0, 0, 0);
color: #d8d9de;
font-size: 1.2em;
font-family: 'apple_chancerychancery';
padding: 0.8% 4%;
border: none;
margin-left: 42%;
cursor: pointer;
box-shadow: inset 2px 2px 9px rgba(199, 255, 100, 0.73), inset -2px -2px 9px rgba(199, 255, 100, 0.73);}
Just 2 changes in the CSS:
#sprite2_contact {
top: 0px !important;
}
just to overcome the top that is inline ..
and
#content {
margin-top: 28%;
}
Well, you have already a margin property there, just place that afterwards so that the other is overwritten
I have set those changes this way, instead of changing yours, so the changes can be more easily seen and reverted

CSS style wont apply in text input boxes

I am having trouble with applying a style in my input box.
I have header.css here
#charset "utf-8";
body, h1, h2, h3, h4, h5, h6, p, div, ul, li {
margin:0;
padding:0;
}
body { font family: Verdana; background-color: #FFFFFF }
#Wrapper {
width: auto;
height:2000px;
margin: 0 auto;
}
#divHeader {
position:0px;
width: 100%;
height: 180px;
background:url(thisheader/header_1.png)
}
#divHeader2 {
position: 180px;
width: 100%;
height: 200px;
background: url(thisheader/SMCFIbanner.png);
}
#box {
background: white;
border: 1px solid #DDD;
border-radius: 1px;
box-shadow: 0 0 3px #DDD inset;
color: #666;
padding: 5px 10px;
width: 185px;
outline: none;
}
when I try to apply the style to the textbox for the password and username using the header.css, it wont apply. I created a new css file just to check, yes.css:
input#box {
background: white;
border: 1px solid #DDD;
border-radius: 1px;
box-shadow: 0 0 3px #DDD inset;
color: #666;
padding: 5px 10px;
width: 165px;
outline: none;
}
log.php
<div>
<form method="post" action="checkLogin.php">
<label>Username</label>
<input type="text" value="" name="myusername" size="20%" class="input_field" title="username" id="box" />
<br>
<br>
<label>Password</label>
<input type="password" value="" name="mypassword" class="input_field" title="password" id="box" />
<br>
<br>
<input type="submit" name="login" value="Login" alt="login" id="submit_btn" title="Login" />
</form>
</div>
and when i try to link this one in my log.php, it worked.
what might be the problem ?
First off, you should not have multiple elements on page with the same id. In this case, both your login and password fields have an ID of "box". Use class instead. You may be better off doing:
<div id='box'>
<form method="post" action="checkLogin.php">
<label>Username</label>
<input type="text" value="" name="myusername" size="20%" class="input_field" title="username" />
<br>
<br>
<label>Password</label>
<input type="password" value="" name="mypassword" class="input_field" title="password"/>
<br>
<br>
<input type="submit" name="login" value="Login" alt="login" id="submit_btn" title="Login" />
</form>
</div>
Then, in the css, do
#box input[type='text']{
blah,blah,blah...
}
The problem could be that you have two elements with the same id.
By the way, you can select to apply the style to all input textfields with this selector.
form input[type=text] {
background: white;
border: 1px solid #DDD;
border-radius: 1px;
box-shadow: 0 0 3px #DDD inset;
color: #666;
padding: 5px 10px;
width: 165px;
outline: none;
}
Try styling the input box like this:
input[type=text] {
background: white;
border: 1px solid #DDD;
border-radius: 1px;
box-shadow: 0 0 3px #DDD inset;
color: #666;
padding: 5px 10px;
width: 185px;
outline: none;
}

CSS form doesn't appear to have any line breaks

I'm working on styling my website forms and found a tutorial that seems to work up to a point... The tutorial includes code to have hover hints, and this code is causing things to get ugly. Instead of the fields all lining up under one another they seem to be attempting to position themselves one right after another and wrapping all the way down the window.
Here is the code element for the feature in question followed by the CSS...
HTML
<form id="defaultform" class="rounded" name="form2" method="post" action="<?php echo $editFormAction; ?>">
<h3>Contact Form</h3>
<div class="field">
<label for="hostess_fname">First Name:</label>
<input type="text" class="input" name="hostess_fname" value="" id="hostess_fname" />
<p class="hint">Enter your name.</p>
</div>
<div class="field">
<label for="email">Last Name:</label>
<input type="text" class="input" name="hostess_fname" value="" id="hostess_lname" />
<p class="hint">Enter your email.</p>
</div>
<input type="submit" value="Lookup Hostess" />
<input type="hidden" name="Lookup" value="form2" />
CSS
#defaultform {
width: 500px;
padding: 20px;
background: #f0f0f0;
overflow:auto;
/* Border style */
border: 1px solid #cccccc;
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
/* Border Shadow */
-moz-box-shadow: 2px 2px 2px #cccccc;
-webkit-box-shadow: 2px 2px 2px #cccccc;
box-shadow: 2px 2px 2px #cccccc;
}
label {
font-family: Arial, Verdana;
text-shadow: 2px 2px 2px #ccc;
display: block;
float: left;
font-weight: bold;
margin-right:10px;
text-align: right;
width: 120px;
line-height: 25px;
font-size: 15px;
}
#defaultform.input{
font-family: Arial, Verdana;
font-size: 15px;
padding: 5px;
border: 1px solid #b9bdc1;
width: 300px;
color: #797979;
}
.hint{
display: none;
}
.field:hover .hint {
position: absolute;
display: block;
margin: -30px 0 0 455px;
color: #FFFFFF;
padding: 7px 10px;
background: rgba(0, 0, 0, 0.6);
-moz-border-radius: 7px;
-webkit-border-radius: 7px;
border-radius: 7px;
}
I just updated the code with more of the HTML from a shorter form that I was trying with the same CSS. I also added some more of the CSS code. I'm getting the same behavior. I'm still confused on selectors and how those are defined and stuff.
I see what you're doing now that you've added your code. It's a pretty simple fix, but hard to catch:
CSS
.field{
clear:both;
}
Here's the jsFiddle