aligning the textboxes and buttons (CSS) - html

Fiddle here
CSS Code:
#searchbox-container {
width: 100%;
height: 80px;
clear: both;
}
.searchbox {
width: 100%;
margin-left:2.5%;
margin-right: 2.5%;
}
.searchbox input {
width: 250px;
height: 18px;
-webkit-border-radius: 20;
-moz-border-radius: 20;
border-radius: 20px;
padding: 10px 20px 10px 20px;
border: 1px solid #16a085;
}
.searchbox input:hover {
width: 250px;
height: 18px;
-webkit-border-radius: 20;
-moz-border-radius: 20;
border-radius: 20px;
padding: 10px 20px 10px 20px;
border: 1px solid #e67e22;
}
/* SECTIONS */
.section-search {
clear: both;
padding: 0px;
margin: 0px;
}
/* COLUMN SETUP */
.col-search {
display: block;
float:left;
margin: 1% 0 1% 5%;
}
.col-search:first-child { margin-left: 0; }
/* GROUPING */
.group-search:before,
.group-search:after {
content:"";
display:table;
}
.group-search:after {
clear:both;
}
.group-search {
zoom:1; /* For IE 6/7 */
}
.btn-search {
-webkit-border-radius: 25;
-moz-border-radius: 25;
border-radius: 25px;
-webkit-box-shadow: 0px 0px 0px #666666;
-moz-box-shadow: 0px 0px 0px #666666;
box-shadow: 0px 0px 0px #666666;
color: #ffffff;
font-size: 16px;
background: #16a085;
padding: 10px 40px 10px 40px;
text-decoration: none;
}
.btn-search:hover {
background: #1abc9c;
text-decoration: none;
}
/* GRID OF THREE */
.search-span_3_of_3 {
width: 100%;
}
.search-span_2_of_3 {
width: 65%;
}
.search-span_1_of_3 {
width: 30%;
}
/* GO FULL WIDTH AT LESS THAN 480 PIXELS */
#media only screen and (max-width: 480px) {
.col-search {
margin: 2% 0 2% 0%;
}
}
#media only screen and (max-width: 480px) {
.search-span_3_of_3 {
width: 100%;
}
.search-span_2_of_3 {
width: 100%;
}
.search-span_1_of_3 {
width: 100%;
}
}
HTML Code:
<div id="searchbox-container">
<div class="searchbox">
<center>
<form>
<div class="section-search group-search">
<div class="col-search search-span_1_of_3">
<input name="city" type="text" placeholder="City" />
</div>
<div class="col-search search-span_1_of_3">
<input name="category" type="text" placeholder="Category" />
</div>
<div class="col-search search-span_1_of_3">
<a class="btn-search" href="#">Search</a>
</div>
</div>
</form>
</center>
</div>
</div>
PROBLEM DEFINITION:
Please visit this for the current scenario "http://jsfiddle.net/Hq6UL/"
1. I am having the problem of overlapping of the two text boxes when screen resolution is lessened.
2. The search button is not aligned with the text boxes. they all need to be in the same horizontal plain.
3. Currently when i hover over the textboxes the color changes to orange but it should be like when i click on the box and even if y mouse moves out from the hover, the color of the border should still remain orange till i am typing inside the box. once i am done typing and i go to the other text box the previous box border should become green and the 2nd box which was green bordered, should turn orange when i am now typing into it.
4. I would like to have tips on how to make the text boxes more attrative, keeping the flat designing style in consideration.
Please Help!!!
Regards!!!

Your main problem comes from the fact that DIV default to block display, while the A (anchor) default to inline display.
So, first turn the A to block display by adding "display: block;" to your ".btn-search" class.
Then, you will notice that it's only 38px height while the other are 40px height. As you have a top & bottom padding of 10px, just fix the height of your same A to 20px by adding a "height: 20px;" to your ".btn-search" class.
I made the update in the JSFiddle and it works as you want:
http://jsfiddle.net/Hq6UL/2/
.btn-search {
-webkit-border-radius: 25;
-moz-border-radius: 25;
border-radius: 25px;
-webkit-box-shadow: 0px 0px 0px #666666;
-moz-box-shadow: 0px 0px 0px #666666;
box-shadow: 0px 0px 0px #666666;
color: #ffffff;
font-size: 16px;
background: #16a085;
padding: 10px 40px 10px 40px;
text-decoration: none;
display: block;
height: 20px;
}
I also added this code so it keeps the color when the input field has the focus:
.searchbox input:focus {
width: 250px;
height: 18px;
-webkit-border-radius: 20;
-moz-border-radius: 20;
border-radius: 20px;
padding: 10px 20px 10px 20px;
border: 1px solid #e67e22;
}

Use this code in the CSS :
/* GO FULL WIDTH AT LESS THAN 850 PIXELS */
#media only screen and (max-width: 850px) {
.col-search {
margin: 2% 0 2% 0%;
}
}
#media only screen and (max-width: 850px) {
.search-span_3_of_3 {
width: 100%;
}
.search-span_2_of_3 {
width: 100%;
}
.search-span_1_of_3 {
width: 100%;
}
}
EDIT :: For the problem with the vertical alignment :
<a class="btn-search" href="#" style="vertical-align: -10px;">Search</a>

Related

Html Css Card breaking page width for no reason

enter image description here
Hello, I am using next js, and as you can see on the most right of the picture the page has an overflow for no reason and it's caused by an html CSS card I built as shown below in the photo. (I assumed it is because of the card because when I remove it the page works fine):
enter image description here
Below is the code of the card:
<div className={styles.container}>
<Row className={styles.Row}>
<Col data-aos="flip-right" className={styles.Col} sm={'auto'} >
<Link href={"/"}>
<a>
<div className={styles.aBox}>
<div className={styles.imgContainer}>
<div className={styles.imgInner}>
<div className={styles.innerSkew}>
<img src="./topbanner2.jpg" />
</div>
</div>
</div>
<div className={styles.textContainer}>
<h3>Flyer</h3>
<div>
This is a demo experiment to skew image container. It looks good.
</div>
</div></div></a></Link>
</Col>
<Col data-aos="flip-right" className={styles.Col} sm={'auto'} >
</Col>
....
below is the css:
.Col a:hover{
text-decoration: none;
color: black;
}
.Row{
width: 80%;
margin: auto;
}
.Col{
padding: 10px !important;
margin: auto;
text-align: center;
overflow-x: hidden !important;
}
.aBox {
display: inline-block;
width: 240px;
text-align: center;
box-sizing:content-box;
}
.aBox:hover{
.textContainer{
border:#04bcff solid 1px
}
}
.imgContainer {
height: 230px;
width: 200px;
overflow: hidden;
border-radius: 0px 0px 20px 20px;
display: inline-block;
}
.imgContainer img {
/* transform: skew(0deg, -13deg); */
height: 250px;
width: 100%;
object-fit: cover;
/* margin: -35px 0px 0px -70px; */
}
.innerSkew {
display: inline-block;
border-radius: 20px;
overflow: hidden;
padding: 0px;
/* transform: skew(0deg, 13deg); */
font-size: 0px;
margin: 30px 0px 0px 0px;
background: #c8c2c2;
height: 250px;
width: 200px;
}
.textContainer {
border:transparent solid 1px;
box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.2);
padding: 120px 20px 20px 20px;
border-radius: 20px;
background: #fff;
margin: -120px 0px 0px 0px;
line-height: 19px;
font-size: 14px;
transition: 0.25s border ease-in-out;
}
.textContainer h3 {
margin: 20px 0px 10px 0px;
color: #04bcff;
font-size: 18px;
}
Any suggestions what would be it?
Add
body * {outline:1px solid red;}
to the CSS file to see the overflowing component.
Pls this trick I learned from Kevin Powell (search him on YouTube)

Positioning issue with contact form (trying to centre)

I need help with what is the best way to fully centre the contact form in the middle of the background image no matter what view the contact form is in(desktop, tablet, mobile). I would like for there to be a smallish amount of space between the bottom and top of the contact form, however, I would like the sides of the form to be further away from the edges of the image.
I hope yous understand what I'm asking for and thanks in advance.
The contact form can be seen on the live url: http://nathan-bayne.co.uk/index1
#contact-section {
background-color: #bce4b8; /* Previous colour that Aileen liked (#A74CAB) */
border-bottom: 1px solid #000;
text-align: center;
padding: 100px 0 0;
min-height: 800px;
width: 100%;
} /* Adjusts section sizing, padding and text alignment */
.contact-section-content {
margin-left: 14%;
margin-right: 14%;
margin-top: 2%;
}
::-webkit-input-placeholder {
text-align: center;
}
.bg-img {
/* The image used */
background-image: url("https://images.pexels.com/photos/807598/pexels-photo-807598.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260");
min-height: 750px;
border-radius: 35px;
margin-top: 2%;
margin-bottom: 3%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
border: 1px solid black;
} /* Sets background image behind contact form, sets sizing, positioning and styles the image */
.contact-section-content .container {
max-width: 60%;
padding: 2%;
background-color: white;
border-radius: 35px;
background-color: rgba(255, 255, 255, 0.15);
backdrop-filter: blur(15px);
border: 1px solid white;
margin-top: 1%;
} /* Sets sizing, styling and positioning of the contact form container */
.container label {
font-size: 2em;
color: white;
} /* Sets sizing of the contact form titles */
.container textarea {
height: 125px;
width: 100%;
border-radius: 35px;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
} /* Sets sizing, positioning and styling of the contact form text area */
input[type="text"] {
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
border-radius: 35px;
} /* Sets sizing, positioning and styling of the input tags for the contact form */
input[type="tel"] {
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
border-radius: 35px;
} /* Sets sizing, positioning and styling of the input tags for the contact form */
.contact-section-content button {
font-size: 2em;
padding: 0.6% 6%;
border-radius: 35px;
color: #fff;
background-color: #339a9a;
border: 1px solid black;
cursor: pointer;
text-align: center;
/* clear: both; May not need this included */
margin-left: 0%;
margin-top: 1%;
} /* Styles the contact form submission button */
.contact-section-content button:hover {
color: rgb(255, 255, 255);
background-color: #004e4f;
border: 2px solid white;
} /* Styles the contact form submission button when you hover over it */
.container input::-webkit-input-placeholder {
font-size: 1.5em;
line-height: 2;
} /* Sets sizing of the contact form input placeholders */
.container textarea::placeholder {
font-size: 1.5em;
line-height: 2;
} /* Sets sizing of the contact form textarea placeholders */
#media only screen and (max-width: 1606px) {
.contact-section-content {
margin-left: 2.5%;
margin-right: 2.5%;
margin-bottom: 6%;
}
::-webkit-input-placeholder {
text-align: center;
}
.bg-img {
/* The image used */
background-image: url("https://images.pexels.com/photos/807598/pexels-photo-807598.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260");
min-height: 750px;
border-radius: 35px;
margin-top: 2%;
margin-bottom: 3%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
} /* Sets background image behind contact form, sets sizing, positioning and styles the image */
.contact-section-content .container {
max-width: 70%;
padding: 2%;
background-color: white;
border-radius: 35px;
background-color: rgba(255, 255, 255, 0.15);
backdrop-filter: blur(15px);
border: 1px solid white;
margin-top: 1.5%;
} /* Sets sizing, styling and positioning of the contact form container */
.container label {
font-size: 2em;
color: white;
} /* Sets sizing of the contact form titles */
.container textarea {
height: 125px;
width: 100%;
border-radius: 35px;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
} /* Sets sizing, positioning and styling of the contact form text area */
input[type="text"] {
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
border-radius: 35px;
} /* Sets sizing, positioning and styling of the input tags for the contact form */
input[type="tel"] {
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
border-radius: 35px;
} /* Sets sizing, positioning and styling of the input tags for the contact form */
.contact-section-content button {
padding: 1% 8%;
font-size: 1.8em;
} /* Styles the contact form submission button */
}
#media only screen and (max-width: 815px) {
.contact-section-content {
margin-left: 2.5%;
margin-right: 2.5%;
margin-top: 10%;
margin-bottom: 15%;
}
::-webkit-input-placeholder {
text-align: center;
}
.bg-img {
/* The image used */
background-image: url("https://images.pexels.com/photos/807598/pexels-photo-807598.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260");
min-height: 670px;
border-radius: 35px;
margin-top: 2%;
margin-bottom: 3%;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
} /* Sets background image behind contact form, sets sizing, positioning and styles the image */
.bg-img form {
margin-bottom: 7.5%;
} /* Sets background image behind contact form, sets sizing, positioning and styles the image */
.contact-section-content .container {
max-width: 85%;
padding: 2%;
background-color: white;
border-radius: 35px;
background-color: rgba(255, 255, 255, 0.15);
backdrop-filter: blur(15px);
border: 1px solid white;
margin-top: 1.5%;
} /* Sets sizing, styling and positioning of the contact form container */
.container label {
font-size: 2em;
color: white;
} /* Sets sizing of the contact form titles */
.container textarea {
height: 125px;
width: 100%;
border-radius: 35px;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
} /* Sets sizing, positioning and styling of the contact form text area */
input[type="text"] {
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
border-radius: 35px;
} /* Sets sizing, positioning and styling of the input tags for the contact form */
input[type="tel"] {
width: 100%;
padding: 15px;
margin: 5px 0 22px 0;
border: none;
background: #f1f1f1;
border-radius: 35px;
} /* Sets sizing, positioning and styling of the input tags for the contact form */
.contact-section-content button {
padding: 1% 8%;
font-size: 2em;
margin-bottom: 4%;
} /* Styles the contact form submission button */
.container input::-webkit-input-placeholder {
font-size: 1.5em;
line-height: 2;
} /* Sets sizing of the contact form input placeholders */
.container textarea::placeholder {
font-size: 1.5em;
line-height: 2;
} /* Sets sizing of the contact form textarea placeholders */
}
<link rel="stylesheet" href='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css' media="screen" />
<section id="contact-section">
<div class="contact-section-content">
<div class="bg-img"><br><br>
<form action="/action_page.php" class="container">
<label for="psw"><b>Name</b></label>
<input type="text" placeholder="Enter Name" name="psw" required>
<label for="email"><b>Email</b></label>
<input type="text" placeholder="Enter Email" name="email" required>
<label for="number"><b>Mobile Number</b></label>
<input type="tel" name="contact_number" placeholder="Mobile Number" pattern="[0-9]{11}"/>
<label for="psw"><b>Contact Summary</b></label>
<textarea name="subject" placeholder="Write a short summary about what you're in need of help with.." required></textarea>
<button type="submit">Submit Form</button>
</form>
</div>
</div>
Just add this to.bg-img :
display: flex; align-items: center;
And set margin-top: 0 for .container
Try to add this to your .bg-image class
.bg-img {
background-image: url("https://images.pexels.com/photos/807598/pexels-photo-807598.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260");
min-height: 750px;
border-radius: 35px;
margin-top: 2%;
margin-bottom: 3%;
display : flex ;
flex-direction : row;
align-items : center;
justify-content: center;
/* Center and scale the image nicely */
background-position: center;
background-repeat: no-repeat;
background-size: cover;
position: relative;
border: 1px solid black;
}
what I added is display:flex and justify-content/align-items : center to center any element inside that container

Displaying a DIV on top of a Textarea element

I have a small "floating_Note_DIV" which I want to display on top of a textarea, as shown in the pictures. As well, I want to show a yellow_DIV below the textarea, flushed with the bottom edge of the textarea. If I do not display the floating_Note_DIV, the textarea is flushed with yellow_DIV (seen below in Image_1).
However, if I display the floating_Note_DIV, a gap appears between the textarea and the yellow_DIV ; i.e., I was thinking that if I put position: relative, and top and left/right I would get the f_N_DIV to fly over the textarea. It does seem to work however it looks like a gap is left where the "footprint" of the f_N_Div is left behind, at it's "supposed-to-be" position between tomato_DIV and yellow_DIV (see below Image_2).
If I use position "Absolute" it gets positioned w.r.t to the whole page, I am expecting the tomato_DIV to move around and so the f_N_DIV will have to be positioned w.r.t the textarea or tomato_DIV.
Any workaround? Thanks, all help appreciated ! !
the HTML is:
<div id='tomato_DIV' >
<textarea id="textarea_main" cols="40" rows="3" maxlength="300"></textarea>
<div id="floating_Note_DIV">Your Thoughts!!</div>
<div id="yellow_DIV"></div>
</div>
the relavant CSS is:
#tomato_DIV
{ background-color: tomato;
padding: 0px 0px 5px 0px;
width: 310px;
border-radius: 5px; }
#textarea_main
{ box-sizing: border-box;
margin: 5px 5px 0px 5px; padding: 2px; /* note: bottom margin is 0 to make flush with yellow div */
width: calc(100% - 10px);
height: 75px;
resize: none; outline: none;
border: 1px solid #737d96; border-radius: 3px; }
#floating_Note_DIV
{ margin: 0px 0px 0px 0px;
padding: 0px 2px 0px 0px;
position: relative; /* how to do this bit? */
right: -232px;
top: -14px;
width: 70px;
height: 11px;
font-size: 8px; font-style: normal; font-weight: bold; color: black;
text-align: right; border: 1px solid #737d96; }
#yellow_DIV
{ margin: 0px 5px 5px 5px; /* note: top margin is 0 to make flush with textarea */
border: 1px solid grey;
border-radius: 3px;
width: calc(100% -10px);
height: 30px; background-color: #fdffb6; }
Is this what you are trying to achieve?
HTML : Put the #floating_Note_DIV element inside #yellow_DIV. You could leave it where it is, but setting top CSS property would have been difficult.
CSS :
Change position property of #floating_Note_DIV from relative to absolute.
Set position property of #yellow_DIV to relative.
Set right to 0.
Set bottom to 100%.
I modified the margin-bottom to 5px to align it perfectly.
#tomato_DIV {
background-color: tomato;
padding: 0px 0px 5px 0px;
width: 310px;
border-radius: 5px;
}
#textarea_main {
box-sizing: border-box;
margin: 5px 5px 0px 5px;
padding: 2px;
/* note: bottom margin is 0 to make flush with yellow div */
width: calc(100% - 10px);
height: 75px;
resize: none;
outline: none;
border: 1px solid #737d96;
border-radius: 3px;
}
#floating_Note_DIV {
margin: 0px 0px 5px 0px;
padding: 0px 2px 0px 0px;
position: relative;
position: absolute;
right: 0;
bottom: 100%;
width: 70px;
height: 11px;
font-size: 8px;
font-style: normal;
font-weight: bold;
color: black;
text-align: right;
border: 1px solid #737d96;
}
#yellow_DIV {
margin: 0px 5px 5px 5px;
/* note: top margin is 0 to make flush with textarea */
border: 1px solid grey;
position: relative;
border-radius: 3px;
width: calc(100% -10px);
height: 30px;
background-color: #fdffb6;
}
<div id='tomato_DIV'>
<textarea id="textarea_main" cols="40" rows="3" maxlength="300">
</textarea>
<div id="yellow_DIV">
<div id="floating_Note_DIV">Your Thoughts!!</div>
</div>
</div>

css adjusting vertical positioning of fixed element

I'm having troubles with positioning the textbox for my chat. I can only make it look good for one specific resolution. On other screen sizes it just looks terrible. How can I adjust the position of the textbox for all resolutions (>1360px) to fit in the little darkgrey area on the bottom. When I try to adjust it for one resolution it won't look good on the other resolutions.
https://jsfiddle.net/4pvfwz11/1/
<div class="chatdiv hidden-xs hidden-sm col-lg-2 col-md-3 pull-right" data-spy="affix">
<div class="scrollbar" id="style-2">
<div class="force-overflow"></div>
<ol class="chat">
<div id="fullchat">
<li class="bot"><div class="avatar"><img src="'+msg.avatar+'" draggable="false"/></div><div class="msg"><div class="name">Username</div><p>The chat text should come here..........</p><time><i class="fa fa-clock-o" aria-hidden="true"></i>19:00</time></div></li>
</div>
<div class="chat_error"></div>
</ol>
</div>
<div class="toggle-sound"></div>
<input class="textarea" id="chat_textbox" type="text" placeholder="Enter message here"/>
<style type="text/css">
div.chat_error {
color: #e20f0f;
padding-left: 10px;
padding-top: 1rem;
}
.chatdiv
{
position: fixed;
left: 40px;
background-color: #101010;
height: 90vh;
}
.chatdiv .name{
top: 3px;
left: 110px;
font-size: 10px;
font-weight: bold;
color: rgba(256,256,256,0.80);
cursor: default;
}
/* M E S S A G E S */
.chat {
list-style: none;
background: none;
margin: 0;
padding: 0 0 50px 0;
margin-top: 60px;
margin-bottom: 10px;
}
.chat li {
padding: 0.5rem;
overflow: hidden;
display: flex;
}
.chat .avatar img {
margin-top: 15px;
width: 40px;
height: 40px;
border-radius: 100%;
-webkit-border-radius: 100%;
-moz-border-radius: 100%;
-ms-border-radius: 100%;
background-color: rgba(255,255,255,0.9);
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
.other .msg {
order: 1;
border-top-left-radius: 0px;
box-shadow: -1px 2px 0px #187006;
margin-left: 10px;
background-color: #27af0c;
}
.self {
justify-content: flex-end;
align-items: flex-end;
}
.self .msg {
order: 1;
border-bottom-right-radius: 0px;
background-color: #0a95db;
box-shadow: 1px 2px 0px #055f8c;
margin-left: 10px;
}
.bot .msg {
order: 1;
border-bottom-right-radius: 0px;
background-color: #a50808;
box-shadow: 1px 2px 0px #6b0606;
margin-left: 10px;
}
.msg {
background: white;
min-width: 50px;
padding: 10px;
border-radius: 2px;
box-shadow: 0px 2px 0px rgba(0, 0, 0, 0.07);
}
.msg p {
font-size: 15px;
margin: 0 0 0.2rem 0;
color: white;
}
.msg time {
font-size: 10px;
color: #ccc;
margin-top: 3px;
float: right;
cursor: default;
-webkit-touch-callout: none;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
}
/* T Y P E */
input.textarea {
position: absolute;
width: 89%;
height: 50px;
left: 15px;
bottom: 3vh;
background: white;
border: none;
outline: none;
padding-left: 10px;
padding-right: 10px;
color: #666;
font-weight: 400;
}
div.toggle-sound {
position: fixed;
bottom: 13vh;
left: 65px;
font-weight: bold;
font-size: 20px;
}
.scrollbar
{
float: left;
height: 80vh;
background-color: #232323;
overflow-y: scroll;
margin-bottom: 25px;
width: 100%;
}
.force-overflow
{
min-height: 90vh;
}
#style-2::-webkit-scrollbar-track
{
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,0.3);
border-radius: 10px;
background-color: #232323;
}
#style-2::-webkit-scrollbar
{
width: 12px;
background-color: #232323;
}
#style-2::-webkit-scrollbar-thumb
{
border-radius: 10px;
-webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
background-color: #E20F0F;
}
</style>
If you want different CSS for different screen sizes you can use something called media queries. I don't know exactly what rules you want to change for different screen sizes, but let's do a quick example. Let's say you want to make the background color of the textbox red on screens with a width less than or equal to 900px. This can be done with the following media query:
#media (max-width: 900px) {
input.textarea {
background-color: red;
}
}
So what you can do is just to figure out what CSS changes you want to do on different screen sizes, and then make media queries for all of them. You can read more about media queries here.

Why does this code load with a blank space on the right on an iPhone?

So in both portrait and landscape the right 30% or so of the screen is just white, only on iPhone and maybe other small screens, as if the width were less than 100%.
Here is my HTML:
<div id="loading">
<div id="loading-message">
<p>Please enable Javascript to view this site.</p>
<p class="tar">-Thanks</p>
</div>
<div id="loadingBar">
<div id="loadingBarInner"></div>
</div>
</div>
And relevant CSS:
#loading {
background: gray;
width: 100%;
position: absolute;
height: 1800px;
box-shadow: inset 0px 0px 500px black;
}
#loading-message {
margin: auto;
border-radius: 30px;
padding: 100px;
box-shadow: 0px 0px 50px 10px black;
width: 300px;
margin-top: 200px;
font-size: 30px;
font-weight: bold;
}
#loadingBar {
margin: auto;
width: 350px;
height: 30px;
margin-top: 300px;
border-radius: 5px;
border: 2px solid black;
padding: 2px;
}
#loadingBarInner {
background: #6d0019; /* Old browsers */
height: 30px;
width: 0px;
border-radius: 5px;
}
instead of using fixed padding in #loading-message use padding
with percentage also use max-width and min-width properties instead of
fixed width in #loadingBar and #loading-message. your iphone has about 400px width and you defined 100px
padding and width of 350px. on big screens it's no problem but in your
iphone it will always load with blank space on right side.
#loading {
background: gray;
width: 100%;
position: absolute;
height: 1800px;
box-shadow: inset 0px 0px 500px black;
}
#loading-message {
margin: 0 auto;
border-radius: 30px;
padding: 10%;
max-width:300px;
min-width:50px;
box-shadow: 0px 0px 50px 10px black;
margin-top: 200px;
font-size: 30px;
font-weight: bold;
}
#loadingBar {
margin: auto;
max-width:300px;
min-width:50px;
height: 30px;
margin-top: 300px;
border-radius: 5px;
border: 2px solid black;
}
#loadingBarInner {
background: #6d0019; /* Old browsers */
height: 30px;
width: 0px;
border-radius: 5px;
}​
also u can use media queries... media queries
What iPhone do you have?
Try to play with the widths.