Textarea extra padding - css

I cant remove the extra padding above and below the textarea in google chrome
https://jsfiddle.net/y4fe39mr/1/
<td rowspan="3" class="biginputcell">
<textarea class="biginput" type="textarea" name="notes" id="notes" value=""></textarea>
</td>
I cannot figure out where the extra 15px padding is comming from in chrome.
.biginput{
width:230px;
height:150px;
font-size:0px;
font-family:sans-serif;
margin:0;
padding:0;
border:0px;
resize: none;
display: block
}
.biginputcell{
background-color:blue;
vertical-align:middle;
height:160px;
}
I have accepted the answer pointing out the issue with rowspan because it was the direct fix to the issue.
However as one of the answers pointed out divs are the better way to make my form, I will be changing the form to div tags rather than an overly complicated table.

The problem is that your column is middle aligned. If you align your textarea to the top, this won't happen.
I personally think there are too many unnecessary classes in your code. You should consider simplifying it. Also, I wouldn't recommend using table for structuring your forms. It can get quite confusing.
Here a suggestion for you.
*{
margin:0;
padding:0;
border: 0;
font-family:sans-serif;
}
.form {
display: table;
padding: 10px;
background-color: blue;
}
.column {
display: table-cell;
vertical-align: top;
}
.column + .column {
padding-left: 10px;
}
.form-group {
display: table;
}
.form-group > * {
display: table-cell;
}
.form-group + .form-group {
margin-top: 10px;
}
.label {
color: white;
font-size:15px;
min-width: 60px;
line-height: 30px;
vertical-align: middle;
text-align: right;
padding-right: 10px;
}
.input{
width:230px;
height:30px;
resize: none;
}
.input.small {
width: 90px;
}
.input.big {
height: 150px;
}
.button{
font-size:15px;
height:90px;
width:90px;
}
<form action="edit.php" method="POST" class="form">
<div class="column">
<div class="form-group">
<label class="label" for="time">Time:</label>
<input class="input" type="text" name="time" id="time" value="" />
</div>
<div class="form-group">
<label class="label" for="events">Event:</label>
<input class="input" type="text" name="events" id="events" value=""/>
</div>
<div class="form-group">
<label class="label" for="notes">Notes:</label>
<textarea class="input big" type="textarea" name="notes" id="notes" value=""></textarea>
</div>
</div>
<div class="column">
<div class="form-group">
<select class="input small" id="preset" onchange="fillpreset(value)">
<option value="0">PRESET</option>
<option value="1">Pre Service</option>
<option value="2">Worship</option>
<option value="3">MC Bridge</option>
<option value="4">Message AM</option>
<option value="5">Message PM</option>
</select>
</div>
<div class="form-group">
<input class="button" type="submit" name="task" value="Go" />
</div>
<div class="form-group">
<input class="button" type="submit" name="task" value="Clear" />
</div>
</div>

Change the rowspan=3 to rowspan=4 in your markup for the elements with classes biglabelcell and biglabelinput
check the following code snippet
*{
margin:0;
padding:0;
}
textarea {
overflow: hidden;
}
.edittable{
height:240px;
width:400px;
border-collapse:collapse;
overflow:hidden;
table-layout: fixed;
}
.labelcell{
width:60px;
height:40px;
font-family:sans-serif;
background-color:blue;
}
.label{
width:50px;
height:30px;
font-size:20px;
font-family:sans-serif;
}
.biglabel{
width:50px;
font-size:20px;
font-family:sans-serif;
}
.biglabelcell{
background-color:blue;
}
.inputcell{
width:240px;
background-color:blue;
}
.input{
width:230px;
height:30px;
font-size:15px;
font-family:sans-serif;
margin:0;
padding:0;
border:0px;
}
.biginput{
width:230px;
height:150px;
font-size:0px;
font-family:sans-serif;
margin:0;
padding:0;
border:0px;
resize: none;
display: block
}
.biginputcell{
background-color:blue;
vertical-align:middle;
height:160px;
}
.selectcell{
width:100px;
height:40px;
font-size:15px;
font-family:sans-serif;
background-color:blue;
}
.select{
width:90px;
height:30px;
border:0px;
}
.buttoncell{
height:100px;
width:100px;
background-color:blue;
}
.button{
height:90px;
width:90px;
border:0px;
}
<form action="edit.php" method="POST">
<table class="edittable">
<tr>
<td class="labelcell">
<label class="label" for="time">Time:</label>
</td>
<td class="inputcell">
<input class="input" type="text" name="time" id="time" value="" />
</td>
<td class="selectcell">
<select class="select" id="preset" onchange="fillpreset(value)">
<option value="0">PRESET</option>
<option value="1">Pre Service</option>
<option value="2">Worship</option>
<option value="3">MC Bridge</option>
<option value="4">Message AM</option>
<option value="5">Message PM</option>
</select>
</td>
</tr>
<tr>
<td class="labelcell">
<label class="label" for="events">Event:</label>
</td>
<td class="inputcell">
<input class="input" type="text" name="events" id="events" value=""/>
</td>
<td rowspan="2" class="buttoncell">
<input class="button" type="submit" name="task" value="Go" />
</td>
</tr>
<tr>
<td rowspan="4" class="biglabelcell">
<label class="biglabel" for="notes">Notes:</label>
</td>
<td rowspan="4" class="biginputcell">
<textarea class="biginput" type="textarea" name="notes" id="notes" value=""></textarea>
</td>
</tr>
<tr>
</tr>
<tr>
<td rowspan="2" class="buttoncell">
<input class="button" type="submit" name="task" value="Clear" />
</td>
</tr>
Hope this helps. If not can you please explain how the page should look like a snapshot would be helpful

Related

divs placement and display [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I'm trying to create a form with this formatting style:
label a
[input text] SUBMIT
label b
[select]
label c
label from [input text] label to [input texŧ] SUBMIT
This is my html with css code:
<style type="text/css">
form {
width:460px;
}
form label {
font-size:12px;
color:#666;
cursor:auto !important;
}
form input[type=text] {
padding:5px;
height:30px;
line-height:30px;
width:370px;
color:#333;
font-size:14px;
}
form select {
padding:5px;
height:30px;
line-height:26px;
width:370px;
color:#333;
font-size:12px;
border:solid 1px #ccc;
overflow:hidden;
}
form input[type=submit] {
height:20px;
width:20px;
background: url("/mini_glass.png") no-repeat scroll 3px 3px transparent;
border:none;
cursor:pointer;
}
</style>
<div class="margin_top_20">
<form action="">
<div>
<div id="A">
<label>a</label>
<input name="q" value="" type="text">
<input value="" type="submit">
</div>
</div>
<div id="B">
<label>b</label>
<select></select>
</div>
<div id="C">
<label>c</label>
<div id="D">
<label>from</label>
<input name="from" value="" type="text" style="width:50px">
<label>to</label>
<input name="to" value="" type="text" style="width:50px">
<input value="" type="submit">
</div>
</div>
</form>
</div>
I think the problem is that I should set properties like position or float but I don't understand how. Should I use the float:left property for some divs? The way that property works is not very clear to me.
Just add rules specific to the labels in div A and div B
#A label, #B label { display:block}
Demo at http://jsfiddle.net/emTKJ/
I made some changes to your form and CSS and here is the Working Solution as per the format that you want.
The HTML:
<div class="margin_top_20">
<form action="">
<div>
<div id="A">
<label>a</label>
<input name="q" value="" type="text">
<input value="submit" type="button">
</div>
</div>
<div id="B">
<label>b</label>
<select></select>
</div>
<div id="C">
<label>c</label>
<div id="D">
<span>from</span>
<input name="from" value="" type="text" style="width:50px">
<span>to</span>
<input name="to" value="" type="text" style="width:50px">
<input value="submit" type="button">
</div>
</div>
</form>
</div>
The CSS:
form {
width:460px;
}
form label {
font-size:12px;
color:#666;
cursor:auto !important;
display:block;
}
span{
font-size:12px;
color:#666;
cursor:auto !important;
}
form input[type=text] {
padding:5px;
height:30px;
line-height:30px;
width:370px;
color:#333;
font-size:14px;
}
form select {
padding:5px;
height:30px;
line-height:26px;
width:370px;
color:#333;
font-size:12px;
border:solid 1px #ccc;
overflow:hidden;
}
form input[type=submit] {
height:20px;
width:20px;
background: url("/mini_glass.png") no-repeat scroll 3px 3px transparent;
border:none;
cursor:pointer;
}
You just needed to add a display:block; for the form label and a <span> tag for from and to and I changed input type from submit to button and valued as submit. You can change and style it as per your requirement.
Hope this helps.
In my experience, when you want to position a group of element, you should wrapped it with div element and style it. With some element have similar style, add it with the same class. Shouldn't set width of form, just wrap the content inside it with a div and set style for it. I fixed your code here. See full demo in jsfiddle
HTML
<div class="margin_top_20">
<form action="">
<div class="line">
<div id="A">
<div>
<label>Lable A</label>
</div>
<div>
<input name="q" value="" type="text" />
<input value="submit button" type="submit" />
</div>
</div>
</div>
<div class="line" id="B">
<div><label>Label b</label></div>
<div><select></select></div>
</div>
<div class="line" id="C">
<div><label>Label c</label></div>
<div id="D">
<label>from</label>
<input name="from" value="" type="text" style="width:50px" />
<label>to</label>
<input name="to" value="" type="text" style="width:50px" />
<input value="submit button" type="submit" />
</div>
</div>
</form>
</div>
CSS:
form {
}
.line{
padding-top:5px;
}
form label {
font-size:12px;
color:#666;
cursor:auto !important;
}
form input[type=text] {
padding:5px;
width:370px;
color:#333;
font-size:14px;
}
form select {
padding:5px;
width:370px;
color:#333;
font-size:12px;
border:solid 1px #ccc;
overflow:hidden;
}
form input[type=submit] {
border:none;
cursor:pointer;
}

Why can I not add margins to my form?

This is the HTML
<div id="header">
</div> <!-- end header -->
<div id="main">
<div id="stylized" class="myform">
<form id="form" name="form">
<label>Name
<span class="small">of company, business, etc...</span>
</label>
<input type="text" name="name" id="name"/>
<label>Status Message
<span class="small">Max 40 Characters</span>
</label>
<input type="text" name="statusmessage" id="statusmessage">
<label>URL to Menu
</label>
<input type="text" name="url" id="url"/>
<button type="submit">Submit</button>
<div class="spacer">
</div>
</form><!-- end form -->
<div id="stylized1" class="myform1">
<form id="form1" name="form">
<label>Street Address
</label>
<input type="text" name="stretaddress" id="streetaddress"/>
<label>City
</label>
<input type="text" name="city" id="city"/>
<label>State
</label>
<input type="text" name="state" id="state"/>
<label>ZIP
</label>
<input type="text" name="zip" id="zip"/>
<div class="spacer">
</div>
</form><!-- end form1-->
</div><!-- end stylized -->
</div><!-- end main -->
</div><!-- end container -->
</body>
</head>
This is the CSS
#container {
margin: auto;
width: 800px;
}
#header {
position: relative;
height: 147px;
background: url(images/header.png) no-repeat;
}
#main {
position: relative;
height: 653px;
background: url(images/main.png) no-repeat;
}
#form {
color: #c4c1c1;
margin: 100px 20px 0px 10px;
}
.spacer{
clear:both;
height:1px;
}
#stylized{
border:solid 2px #c4c1c1;
}
#stylized label{
display:block;
font-family: arial;
font-weight:bold;
width:140px;
margin: 2px 0 0px 10px;
}
#stylized .small{
color:#c4c1c1;
display:block;
font-size:12px;
font-weight:normal;
width:140px;
}
#stylized input{
float:left;
font-size:15px;
padding:5px 25px;
border:solid 1px #c4c1c1;
width:200px;
margin:2px 0 20px 10px;
}
#stylized button{
clear:both;
margin:133px 0 0px 100px;
width:125px;
height:31px;
text-align:center;
line-height:3px;
color:4b4b4b;
font-size:15px;
font-weight:bold;
}
#stylized1{
position: relative;
margin: -1600px 0px 10px 450px;
}
The top margin, no matter how many times I change it, never has the correct coordinates. Every time I change the margin, it just goes back to the same place visually. How come? Is it because of the #container width? Or do I need some code? I'm fairly new to this. Thanks for your help.
#stylized1 label{
display:block;
float:left;
font-family: arial;
font-weight:bold;
width:140px;
color:#c4c1c1;
margin: 2px 0px 0px 10px;
}
#stylized1 input{
font-size:15px;
padding:5px 25px;
border:solid 1px #c4c1c1;
width:200px;
margin:0px 0px 20px 10px;
}
Cut and paste are your enemy. I doubt you want duplicate forms, one or each half of the form entry. Also, you are using position relative all over the place. If you are doing that then you are probably doing something wrong. In this solution I floated the two entry divs to the left. You can adjust the top-margin on stylized1 to position it. I also cleaned up a lot of your html structure.
I was kind of assuming you were editing top margin on the element with -1600px, but if I am wrong please let me know which one you were editing margins on.
http://jsfiddle.net/fVh23/
<div id="container">
<div id="header"></div> <!-- end header -->
<div id="main">
<form id="form" name="form">
<div id="stylized">
<label>Name
<span class="small">of company, business, etc...</span></label>
<input type="text" name="name" id="name"/>
<label>Status Message
<span class="small">Max 40 Characters</span></label>
<input type="text" name="statusmessage" id="statusmessage">
<label>URL to Menu</label>
<input type="text" name="url" id="url"/>
</div> <!-- end stylized -->
<div id="stylized1">
<label>Street Address</label>
<input type="text" name="stretaddress" id="streetaddress"/>
<label>City</label>
<input type="text" name="city" id="city"/>
<label>State</label>
<input type="text" name="state" id="state"/>
<label>ZIP</label>
<input type="text" name="zip" id="zip"/>
</div><!-- end stylized1 -->
<br style="clear: both;" />
<button type="submit">Submit</button>
<div class="spacer">
</form><!-- end form1-->
</div><!-- end main -->
</div><!-- end container -->

how to position radio button outside of a block with css

I would like to create a question row like this http://imageshack.us/photo/my-images/200/questionh.png/
At this time, my html source is :
<p class="questionrow">
<span class="question">question label</span>
<span class="reponses">
<input type='radio' class="radiocontrol"/><label class="radioanswer">Oui</label>
<input type='radio' class="radiocontrol"/><label class="radioanswer">Non</label>
</span>
</p>
(but i can change it)
ths css is :
.questionrow
{
width:1000px;
background-color: #EDF2BE;
}
.question
{
width: 300px;
padding-left: 30px;
padding-right: 30px;
display: inline-block;
}
.reponses
{
width: 600px;
display: inline-block;
}
.radiocontrol {
border: 1px solid #006;
background: #ffc;
}
I'd like to have 2 effects :
I would like to put the label outside, on top of the colored line. I would like to have the label on the same column of the radio button.
I would like to draw a vertical line (but I imagine it will be easy if there is a solution for the previous)
Does someone has some idea about that ?
Regards
Here is a solution that closely resembles your sample image...
Demo: http://jsfiddle.net/Zjnw9/1/
HTML...
<div class="row">
<p class="q">This is a question?</p>
<ul class="options">
<li><label>One</label><input type="radio" /></li>
<li><label>Two</label><input type="radio" /></li>
<li><label>Three</label><input type="radio" /></li>
<li><label>Four</label><input type="radio" /></li>
</ul>
</div>
CSS...
.row {
padding-bottom: 2em;
}
.q {
background-color: #EDF2BE;
margin-top: 1.2em;
padding: 0.5em;
}
.options {
float: right;
margin-top: -3.4em;
}
.options li {
float: left;
width: 100px;
text-align: center;
border-left: 1px solid #999;
padding: 0em 0.5em 0.7em;
}
.options label {
display: block;
font-size: 9pt;
padding-bottom: 0.8em;
}
Use tables instead? span is pretty meaningless for this. This is exactly what tables are meant for.
<table>
<tr>
<th></th>
<th><label for="radio1">Label 1</label></th>
<th><label for="radio2">Label 2</label></th>
<th><label for="radio3">Label 3</label></th>
</tr>
<tr>
<td>Lorem ipsum dolor sit amet.</td>
<td><input type="radio" name="group" id="radio1" /></td>
<td><input type="radio" name="group" id="radio2" /></td>
<td><input type="radio" name="group" id="radio3" /></td>
</tr>
</table>
Here is a CSS solution, without a table.
div {float:left;padding:0 1em; border-right:1px solid gray; height:50px;}
<div>
<p>question label</p>
</div>
<div>
<label>Oui</label><br />
<input type='radio'/>
</div>
<div>
<label>Non</label><br />
<input type='radio'/>
</div>
Works in FF and Chrome for me.

form not showing up properly in chrome and IE6

Here is my page. I need to insert whole code here.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script src="js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$('#tabs ul li:first a').addClass("active");
$('#forms').find('form').hide().fadeIn(1500);
$("#tabs ul li").click(function() {
$("#tabs ul li").removeClass("active");
$(this).addClass("active");
$("#forms form").hide();
var activeTab = $(this).find("a").attr("href");
$(activeTab).fadeIn();
return false;
});
});
</script>
<style type="text/css">
* { margin:0; padding:0; }
body { background:#27476B; }
.clear { clear:both; }
#wrapper { width:510px; height:331px; overflow:hidden; padding:10px; }
#tabs ul { padding-left:15px; list-style:none; }
#tabs ul li { display:block; float:left; text-align:center; }
#tabs ul li a { padding:3px 20px 2px 20px; color:#fff; text-decoration:none; border-top:1px solid #ccc; border-left:1px solid #ccc; border-right:1px solid #ccc; }
#tabs ul li a:hover { background:#AEBAC1; }
#tabs ul li a.active, #tabs ul li.active a:hover { background:#AEBAC1; color:#333; }
#forms form { background:#AEBAC1; border:2px solid #333; padding-left:5px; }
.twocol { display:block; float:left; width:250px; margin-bottom:10px; }
.twocol label { margin-top:.33em; display:block; width:240px;}
.twocol select, .twocol input[type="text"] { background:#456A87; color:#fff; display:block; width:240px; font-size:16px; }
.twocol span { padding:0 8px 0 5px; }
.search { width:500px; text-align:center; margin-bottom:5px; }
</style>
</head>
<body>
<div id="wrapper">
<div id="tabs">
<ul>
<li>Properties</li>
<li>Developments</li>
<li>Agents</li>
</ul>
</div>
<div class="clear"></div>
<div id="forms">
<!--
Search Form for Properties
-->
<form id="properties" name="properties" method="post" action="">
<div class="twocol">
<label for="city">City:</label>
<select name="city" size="1">
<option>-</option><option>asdfadf</option><option>-</option>
</select>
<label for="bedrooms">Bedroom:</label>
<select name="bedrooms" size="1">
<option>-</option>
</select>
<label for="minprice">Minimum Price:</label>
<select name="minprice" size="1">
<option>-</option>
</select>
<label for="minarea">Minimum Area:</label>
<select name="minarea" size="1">
<option>-</option>
</select>
<label for="propertytype">Property Type:</label>
<select name="propertytype" size="1">
<option>-</option>
</select>
</div>
<div class="twocol">
<label for="location">Location:</label>
<select name="location" size="1">
<option>-</option>
</select>
<label for="addedwithin">Added Within:</label>
<select name="addedwithin" size="1">
<option>-</option>
</select>
<label for="maxprice">Maximum Price:</label>
<select name="maxprice" size="1">
<option>-</option>
</select>
<label for="maxarea">Maximum Area:</label>
<select name="maxarea" size="1">
<option>-</option>
</select>
<label for="searchfor">Search For:</label>
<input name="searchfor" type="radio" value="sale" /><span>Sale</span>
<input name="searchfor" type="radio" value="purchase" /><span>Purchase</span>
<input name="searchfor" type="radio" value="rental" /><span>Rental</span>
</div>
<hr class="clear" /><br />
<div class="search">
<input type="submit" value="Search" />
</div>
</form>
<!--
Search Form for Developments
-->
<form id="developments" name="developments" method="post" action="">
<div class="twocol">
<label for="city">City:</label>
<select name="city" size="1">
<option>-</option><option>asdfadf</option><option>-</option>
</select>
</div>
<div class="twocol">
<label for="developmentname">Development name:</label>
<input type="text" name="developementname" />
</div>
<hr class="clear" /><br />
<div class="search">
<input type="submit" value="Search" />
</div>
</form>
</div>
</div>
</body>
</html>
Here is the perfect view (on Firefox)
Following problems are identified by me, Please let me know if there are some others too.
IE8 and Chrome are showing some extra height (which is displaying a little part of 2nd form)
IE6 not showing the width specified in CSS.
In IE6, initially tabs div is touching with the forms div. But on mouse over it adds some extra spacing.
How can it be solved.
I am not sure what you mean by points 1 & 2, but 3 I got it fixed. I might have fixed 1 & 2(not sure).
Let me know how this works for you.
http://jsfiddle.net/3uMyA/3/

How to format my form with CSS?

Here is the HTML for my left column:
<div id="leftcolumn">
<ul id="mainnavigation">
<li>Inicio</li>
<li>Evaluaciones</li>
<li>Docentes</li>
<li>Soporte</li>
</ul>
<div id="loginarea">
Username:
<input type="text" name="Username" />
Password:
<input type="password" name="Password" />
<input type="submit" value="Entrar" />
</div>
</div>
And here is my CSS:
#leftcolumn
{
float:left;
position:relative;
top:20px;
left:20px;
}
#leftcolumn ul#mainnavigation
{
font-size:16px;
}
#leftcolumn ul#mainnavigation li
{
padding-top:8px;
}
#leftcolumn ul#mainnavigation li a
{
text-decoration:none;
color:White;
}
#leftcolumn ul#mainnavigation li a:hover
{
text-decoration:underline;
color:Lime;
}
#loginarea
{
margin-top:20px;
}
#loginarea input
{
float:left;
}
I'm trying to have a small login form on that left navigation area and I'd like the label to be on top of their respective textbox.
Any help?
Use labels, this is what they are for
<label for="username">Username:</label>
<input type="text" name="Username" id="username" />
<label for="password">Password:</label>
<input type="password" name="Password" id="password" />
<input type="submit" value="Entrar" />
Then if you make the labels display:block they will line up on top of the inputs
I'm guessing you want the two inputs to be side by side with the label on top. If so, I would use the following HTML:
<div id="form">
<ul>
<li>
<label for="username">Username:</label>
<input type="text" name="username" id="username" />
</li><li>
<label for="password">Password:</label>
<input type="password" name="password" id="password" />
</li>
</ul>
<input type="submit" value="Entrar" id="submit" /></div>
Then float the list items and add display: block to the labels.
#form {
overflow: hidden;
}
#form li {
width: 180px;
float: left;
margin-right: 10px;
}
#form li label {
font-size: 11px;
font-weight: bold;
display: block;
margin-bottom: 2px;
}
#form #submit {
clear: both;
}
try ths::
<div id="leftcolumn">
<ul id="mainnavigation">
<li>Inicio</li>
<li>Evaluaciones</li>
<li>Docentes</li>
<li>Soporte</li>
</ul>
<div id="loginarea">
<label for="Username">Username:</label>
<input type="text" name="Username" id="Username" />
<label for="Password">Password:</label>
<input type="password" name="Password" id="Password" />
<input type="submit" value="Entrar" />
</div>
</div>​
with this css:
#leftcolumn
{
float:left;
position:relative;
top:20px;
left:20px;
}
#leftcolumn ul#mainnavigation
{
font-size:16px;
}
#leftcolumn ul#mainnavigation li
{
padding-top:8px;
}
#leftcolumn ul#mainnavigation li a
{
text-decoration:none;
color:White;
}
#leftcolumn ul#mainnavigation li a:hover
{
text-decoration:underline;
color:Lime;
}
#loginarea
{
margin-top:20px;
}
#loginarea input
{
display:block;
}
#loginarea label {
display:block;
}
​
Check out this tutorial, really helpfull for dynamic CSS.
http://articles.sitepoint.com/article/fancy-form-design-css
and some of the examples http://designshack.co.uk/articles/10-css-form-examples. They are cross browser too.

Resources