How to style this form using CSS?
Tags: html,css
Problem :
i'm a beginner at CSS and trying to do a NETTUTS , but there's a portion in the webpage that i don't know what exactly to do in CSS to make it look right ...
I just can't get this input text boxes, textarea and the button to be aligned like that , and to be honest the tutor isn't doing a great job to clearing stuff out
Using alternative and absolute positioning, and setting top and right spacing is kinda no a good idea i think ... I'm trying to align them using FlexBox feature but don't know why those elements are not moving at all ...
Here's my HTML & CSS3 code (for chrome) :
<section id="getAfreeQuote">
<h2>GET A FREE QUOTE</h2>
<form method="post" action="#">
<input type="text" name="yourName" placeholder="YOUR NAME"/>
<input type="email" name="yourEmail" placeholder="YOUR EMAIL"/>
<textarea name="projectDetails" placeholder="YOUR PROJECT DETAILS."></textarea>
<input type="text" name="timeScale" placeholder="YOUR TIMESCALE"/>
<button>Submit</button>
</form>
#getAfreeQuote form {
display:-webkit-box;
-webkit-box-orient:vertical;
height:500px;
}
#getAfreeQuote input[name="yourName"]{
-webkit-box-ordinal-group:1;
}
#getAfreeQuote input[name="yourEmail"]{
-webkit-box-ordinal-group:1;
}
#getAfreeQuote textarea{
-webkit-box-ordinal-group:2;
}
#getAfreeQuote input[name="timeScale"]{
-webkit-box-ordinal-group:3;
}
#getAfreeQuote button {
-webkit-box-ordinal-group:4;
}
and the result :
Solution :
Here's how I'd do it:
<section id="getAfreeQuote">
<form method="post" action="#">
<h2>Get a free quote</h2>
<input type="text" name="yourName" placeholder="YOUR NAME"/>
<input type="email" name="yourEmail" placeholder="YOUR EMAIL"/>
<textarea name="projectDetails" placeholder="YOUR PROJECT DETAILS."></textarea>
<br /><input type="text" name="timeScale" placeholder="YOUR TIMESCALE"/>
<br /><input type="submit" value="Submit!" />
<div class="clear"></div>
</form>
</section>
<style>
#getAfreeQuote h2 {
text-transform: uppercase;
color: blue;
}
div.clear {
clear: both;
}
#getAfreeQuote form {
width: 25em;
position: relative;
}
#getAfreeQuote input[name="yourName"]{
width: 43%;
}
#getAfreeQuote input[name="yourEmail"]{
width: 55%;
float: right;
}
#getAfreeQuote textarea{
width: 100%;
height: 10em;
}
#getAfreeQuote input[name="timeScale"]{
width: 100%;
}
#getAfreeQuote input[type="submit"]{
text-transform: uppercase;
background: orange;
border: none;
padding: 1em 2em;
color: white;
float: right;
}
</style>
CSS Howto..
I think the main cause of the conflict here is your assumption that media queries were implemented to save bandwidth. They were implemented to display different things at different sizes,...
There are a number of ways you can achieve that effect. The page in question looks like it simply uses an image background in a css style. The simplest example...
*{margin:0;} .container{ overflow:hidden; height:100px; background:#ddd; } .container a{ display:block; } .container a:nth-child(1){ margin-top: 50px; } <div class="container"> <a href="/link">Link1 </a> <a href="/link">Link2 </a> </div> .container a{ display:block; /* bam,...
Here's an example with a +/- button, no images. All text and CSS. http://jsbin.com/ikeca ...
If I understood correctly what you want,then you want to target your div's not divs inside them : div.G:nth-child(even) {background: #CCC;} div.G:nth-child(odd) { background: #FFF;} It's always preferable to use...
Notice that they also have this in their CSS, which you've left out: .inspiration { background-attachment: scroll,scroll,fixed; } Perhaps you missed it because it's held within a media query....
If you mean without using jQuery: // If you only want to operate on the first match setTimeout(function(){ document.querySelector('.green.bar .inner').style.width = '20%'; }); Or: // If you want to operate...
Not sure whether you have an .htaccess file or not, but one option would be to put in a rewrite rule for request under a folder "images" to be redirected...
Can you please provide a JSFiddle of your work? Without it I can only give you the jQuery example: draggable effect. $(document).ready(function(){ $('#car').draggable(); ); I have also seen the use...
Break up your stylesheet into modules: Navigation, content types, header, footer, etc. Don't use ids for assigning styles. This gives some more information on why that is, and more helpful...
There is a getSpecificity() function available at the inIDOMUtils API in Firefox. To use this API you'll have to write your own Firefox extension, though. This was requested for Firebug,...
Use the line-height! ie: p { line-height:20px; } ...
Best thing to do is to put the hover state for the main link on the 'li' rather than the 'a' tag. ul#nav li:hover { // do something } ...
Bootstrap container classes have max-width values of none, 750px, 970px, 1170px .. depending on the screen size. Refer http://getbootstrap.com/css/#grid-options You can change the .container class to .container-fluid and remove margin-left:...
You can import the CSS file like stara_wiedzma said. However you can't import bootstrap's .btn class for input[Type=button], input[Type=submit], input[Type=reset] globally with CSS I think you are looking for something...
$(".specs.laptop").show(); OR you could use the is() function in jquery. it takes a selector and tells you if the element conforms to it: $(".specs").is(".laptop"); //returns true if the element has...
You can override the css defined by jQuery UI css in your application css file or on the page. You can set the padding as below and override all the...
If you don't want to change your HTML or CSS, change your JQuery to this: $(document).ready(function () { $('.showHide').click(function() { $(this).next().find('li').slideToggle('slow'); }); }); EDIT: Here is a basic version with...
I think you need JavaScript for this, because you need to determine the distance between the bottom of header and the top of footer. You can use getBoundingClientRect() for that....
If you really want to use submit button inside <a> than you could use this instead.without <a> tag. HTML <input type="submit" class='button' value="Mail US" onclick="window.location.href='mailto:email@email.co'"> CSS .button { font: bold...
Mobile WAP sites need to be coded in xHTML MP (Mobile profile) markup as this is most friendly for mobile devices CSS need to use ,,em" value for sizes instead...
The functionality or process hasn't changed between v5.2 - v5.3 so the normal workflow of adding a new theme will still work. Create a new theme with the following folder...
CSS3 adds the background-size property : http://www.w3schools.com/cssref/css3_pr_background-size.asp which you can use with IE9 and above http://caniuse.com/#feat=background-img-opts Otherwise your options are to use a bigger background image OR use a div...
white-space:nowrap; is what you're looking for, placed in allImagesContainer See a DEMO...
Inline blocks have this issue. For more details read this There are several ways using float. Using flexbox. Removing white spaces between tags in html. Negative margins ..... for example...
You can explicitly add a CSS class to custom controls using the CssClass property: .static-position { position: static; } <telerik:RadComboBox ID="radcbFrom" CssClass="static-position" ...> .... </telerik:RadComboBox> Update: We found the solution...
You can extend the code that you already have for the swatch, and add some logic to control what table should be displayed. It should be easy as both have...
Put the image in a separate div, all inside the header, like so: <div id="header"> <div id="banner"></div><!-- --><div id="menubar"></div> </div> Then use display: inline-block; on #banner and #menubar. Note the...
This comes in two parts: To see if hover is enabled, look at the tag, and see if the has a tag:hover element in the CSS. To action something else...
Here's the best I can come up with using only CSS modifications (JSFiddle: http://jsfiddle.net/zKRYM/2/): td:nth-child(2n-1) { background: lightgreen; border-left: 2px solid blue; } td:nth-child(2n) { display: block; background: pink; margin-right:...