I've been following a tutorial from a book on html and css.
I tried doing a plain header design like youtube's but I can't seem to get the search box and the button to display properly.The button is rendered about 10px lower than the search box as if it had the top padding set.
Can be seen here http://www.wourm.com/index.html
can anyone see why it's happening?
[EDIT : Adding html and CSS to this page]
<!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 content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>Awtunes.com</title>
<link href="awtunes.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="container">
<div class="header">
<div class="logo floatL"><img src="images/logo.png" alt="Awtunes.com logo"/></div>
<div id="find-videos" class="search floatL" style="top:0px;" >
<form id="searchVideos" name="searchVideos" method="get" action="/">
<input name="q" type="text" class="searchBox" id="searchBox" /><input type="submit" class="searchbutton" value="" />
</form>
</div>
<div class="menu floatL">
<ul>
<li>Videos</li>
<li>Music Videos</li>
<li>Trailers</li>
<li>Create Account</li>
<li>Sign in</li>
</ul>
</div>
</div>
</div>
</body>
</html>
and the css
.awtunes {
font-family: "Courier New", Courier, monospace;
}
.container {
width: 980px;
top: 0px;
margin-left: auto ;
margin-right: auto ;
}
.floatL {
float: left;
position:relative;
}
.floatR {
float: right;
position:relative;
}
.searchBox {
border-style:none;
border-width:0px;
width: 360px;
background-image: url(images/search_bar.png);
background-repeat:no-repeat;
height: 40px;
font-size: 18px;
}
.searchbutton {
border-style:none;
border-width: 0px;
background-repeat:no-repeat;
background-image: url(images/search_button.png);
background-repeat: no-repeat;
width: 55px;
height: 40px;
}
.logo {
width: 122px;
height: 50px;
}
.menu {
width:430px;
}
.search {
width: 425px;
height: 40px;
}
.split {
background-image: url(images/split.jpg);
background-color: #C0C0C0;
background-repeat: no-repeat;
width: 1px;
height: 18px;
}
ul
{
list-style-type: none;
padding: 0px;
margin: 0px;
}
li
{
background-image: url(images/split.jpg);
background-repeat: no-repeat;
float: left;
margin: 0 0.15em;
}
if this code comes from a book you better buy a new one.. serious. to get the button aligned just add your floatL class to both of you input fields.
I suggest a CSS reset such as the YUI CSS reset. A cursory check in IE and FF shows some pretty serious inconsistency already. If you use a CSS reset stylesheet, this will at least set your code on a level playing field between browsers. YUI CSS Reset: http://developer.yahoo.com/yui/reset/
Once you have a resource like this in place, many quirks of layout are already handled.
It seems to be because of .searchBox { font-size: 18px; }. If you take all the other styles off of the input.searchBox, you can see that changing the font-size changes the size of the plain old text input, which changes the height of the container of the text input and the button.
I also think it would be a good idea to add your HTML and CSS to this question so that if someone is looking at this question in the future and your site is different, they can still learn from your question!
.searchbutton { vertical-align: top; }
A quick fix to your current code would be to add something like:
.searchbutton {
position: relative;
top: -15px;
}
carolclarinet is right here -- the font-size attribute is the problem (at least in FireFox). I'm not sure if you're using the IE Developer Tools to check your CSS issues, but I'd recommend using it as well as FireBug for FireFox. They'll let you play around with your styles without the tedious modify/save/refresh cycle.
Related
I am trying to create Google's Advanced Search page copy. I am new to programming and I'm having 2 problems. First is that link titled "google search" should be inside the gray bar positioned at the start of the page. Second, I am trying to write css code to reverse positions of texts and their correlated input fields, because I noticed in Google's html that it is also coded in reverse and then corrected from initial position.
Help would be greatly appreciated!
.label {
color: rgb(218, 32, 32);
margin-left: 15px;
padding: 15px;
margin-bottom: 15px;
} */
html, body {
padding: 0;
margin: 0;
font-size: 16px;
}
.navbar {
padding: 20px;
text-align: right;
size: default;
}
.navbar a {
margin: 0 10px;
color:black;
text-decoration: none;
}
.navbar a:hover{
text-decoration: underline;
}
.content {
margin-top:100px;
text-align:center;
}
#textbox {
font-size: large;
height: 30px;
width: 500px;
border-radius: 25px;
}
.graybar{
background-size: 75% 50%;
background: #f1f1f1;
font: 13px/27px Arial,sans-serif;
height: 60px;
width: 100%;
}
#image {
height: 33px;
width: 92px;
margin: 15px;
}
.margin {
margin-left: 10px;
margin-right: 10px;
margin-bottom: 10px;
}
body {
font-family: arial,sans-serif;
}
<!DOCTYPE html>
<html lang="en">
<head>
<title>Advanced Search</title>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
<div class="graybar">
<img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" id=image>
<div class=navbar>
<a href="index.html">
Google Search
</a>
</div>
</div>
<div class="label">Advanced Search</div>
<h3 style="font-weight:normal">Find pages with...</h3>
<form action="https://google.com/search">
<input class="margin" value autofocus="autofocus" id="xX4UFf" name="as_q" type="text">
<label for="xX4UFf" class="float">all these words:</label>
<br>
<input class="margin" value autofocus="autofocus" id="CwYCWc" name="as_epq" type="text">
<label for="CwYCWc" class="float">this exact word or phrase:</label>
<br>
<input class="margin" value autofocus="autofocus" id="mSoczb" name="as_oq" type="text">
<label for="mSoczb" class=float>any of these words:</label>
<br>
<input class="margin" value autofocus="autofocus" id="t2dX1c" name="as_eq" type="text">
<label for="t2dX1c" class="float">none of these words:</label>
<br>
<input type="submit">
</form>
</body>
</htmL>
Here is how website looks
Assuming that you can change your HTML, flexbox is the solution to both of your issues.
Let's start with your header. You need your image and your text to be both in the grey box, with the image on the left side and the text on the right side.
If you set your header to use display: flex, then you can specify justify-content: space-between to tell the browser to render the child elements with as much space as is possible between them. For two children, that will result in the first child being on the left, and the second child being on the right. If there were more children, they'd be spaced evenly between (eg left, middle, right for three children etc.)
In your case, this would simply require adding the appropriate styling to the .graybar class which is serving as your header:
.graybar {
display: flex;
flex-direction: row;
justify-content: space-between;
}
.graybar {
display: flex;
flex-direction: row;
justify-content: space-between;
background-size: 75% 50%;
background: #f1f1f1;
font: 13px/27px Arial, sans-serif;
height: 60px;
width: 100%;
}
.navbar {
padding: 20px;
text-align: right;
size: default;
}
.navbar a {
margin: 0 10px;
color: black;
text-decoration: none;
}
.navbar a:hover {
text-decoration: underline;
}
#image {
height: 33px;
width: 92px;
margin: 15px;
}
body {
font-family: arial, sans-serif;
}
<div class="graybar">
<img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" id=image>
<div class=navbar>
Google Search
</div>
</div>
I've left the other styling as you had in your original.
CSS's flexbox is extremely powerful; you can use it for your other issue with the labels/inputs as well, if you can modify your HTML. Looking at the actual Google advanced search page here, your HTML doesn't actually look anything like the original, so I'm assuming you're not restricted to keeping the same HTML as you have in your original post.
Let's instead structure our HTML like this:
<div class="row">
<input type="text" id="allwords" >
<label for="allwords">All these words</label>
</div>
We can now apply display: flex to each row and leverage the flex-direction property to reverse the order of the children so that the label is displayed prior to the input.
.row {
display: flex;
flex-direction: row-reverse;
justify-content: flex-end;
}
label {
display: block;
margin-right: 8px;
}
<div class="row">
<input type="text" id="allwords">
<label for="allwords">All these words:</label>
</div>
Generally I wouldn't recommend doing it like this, but I'm equally unsure why you're trying to force inputs before labels in your HTML. :)
For more information about CSS's flexbox, I highly recommend this guide from CSS-Tricks.
Hey if anyone is able to assist it would be much appreciated, I have no idea how to move the following textbox to where I want it to be.
This is my HTML Code:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="Stylesheet.css">
</head>
<body>
<img src="../Resources/MainBrowser.png" alt="SearchEngineGIF" class="custom2">
<img src="../Resources/SearchEngineGIF.gif" alt="SearchEngineGIF" class="custom1">
<input type="text" placeholder="Insert Keyword Here">
</body>
</html>
And here is the CSS behind it:
.custom1 {
display: block;
margin-left: auto;
margin-right: auto;
transform: translateY(-210px);
width: 23%;
}
.custom2 {
display: block;
margin-left: auto;
margin-right: auto;
transform: translateY(+25px);
width: 25%;
}
input[type=text]{
width:20%;
border:2px solid #000000 ;
border-radius:4px;
margin:8px 0;
outline:none;
padding:8px;
box-sizing:border-box;
transition:.3s;
font-size: 20px;
text-align: center;
}
input[type=text]:focus{
border-color:dodgerBlue;
box-shadow:0 0 8px 0 dodgerBlue;
}
input[type=text]::placeholder{
font-family: Calibri;
font-size: 20px;
font-style: italic;
text-align: center;
}
It would also be useful if anyone knew how to make it not move when zooming in and out, Setting the position to fixed doesnt help as I am moving a gif inside of the Image by transforming it up/ down y pixels
EDIT - MainBrowser.png is the whole image above "Insert Keyword Here" textbox, minus "Geoorgle" which is SearchEngineGIF.gif
Instead you can just use the form tag
<form style="width:25%;height:auto;">
<img src="yourimage.jpg" style="width:25%;">
<br>
<input type="text" style="width:20%;"><img src="searchimage.jpg" style="width:5%;">
</form>
Change the source of the images and the width according to your need.
You can also use the table tag if you want
And about the image not moving, once you fix the position, put the top and left parameters for the form in the style.
Example:
top:25%;
left:25%;
I'm new in html and css so i have a question.
I am messing around with some stuff but after placing some images on my page i can't click on my links anymore.
HTML:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/style.css" media="screen" title="no title" charset="utf-8">
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<title>Rijschool Houben</title>
</head>
<body>
<div id="header"></div>
<div id="header-pic"><img src="image/test.png"></div>
<p>
<div id="nav-bar">
<ul>
<li>|Home|</li>
<li>Info|</li>
<li>Prijzen|</li>
<li>Acties|</li>
<li>Machtiging|</li>
<li>Theorie|</li>
<li>Begeleid rijden|</li>
<li>Bromfiets|</li>
<li>Contact|</li>
</ul>
</div>
</p>
<p>
<div id="icon-main">
<i class="fa fa-mobile" style="font-size:28px;"></i><a>046-4524501</a><br />
<i class="fa fa-paste" style="font-size:18px;"></i><a>raymond#rijschoolhouben.nl</a><br />
<i class="fa fa-facebook-official" style="font-size:20px;"></i><a>Volg ons op Facebook!</a>
</div>
</p>
<p>
<div id="img-1">
<img src="image/1.jpg" alt="Scooter" width="330px" height="400px"/>
</div>
<div id="img-2">
<img src="image/2.jpg" alt="Geslaagde 1" width="337px" height="400px"/>
</div>
<div id="img-3">
<img src="image/3.jpg" alt="Geslaagde 2" width="337px" height="400px"/>
</div>
<div id="img-4">
<img src="image/4.jpg" alt="Geslaagde 3" width="337px" height="400px" />
</div>
<div id="img-5">
<img src="image/5.jpg" alt="Geslaagde 4" width="337px" height="400px" />
</div>
<div id="img-6">
<img src="image/6.jpg" alt="Geslaagde 5" width="337px" height="400px" />
</div>
</p>
</body>
</html>
CSS:
div#header{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100px;
background-color: white;
}
div#header-pic{
position: fixed;
height: 50px;
left: 500px;
}
div#nav-bar{
position: fixed;
padding-top: 130px;
left: 0;
width: 100%;
white-space: nowrap;
}
div#nav-bar ul{
list-style: none;
text-align: center;
background-color: #323232;
padding: 10px 0;
}
div#nav-bar li{
display: inline;
}
div#nav-bar li a{
text-decoration: none;
color: white;
padding: 14px 16px;
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
}
div#icon-main{
position: fixed;
color: #323232;
padding: 10px;
}
div#icon-main i{
padding: 5px;
}
div#icon-main a{
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
}
div#img-1 {
position: fixed;
left: 0;
padding-top: 184px;
width: 100%;
}
div#img-2 {
position: fixed;
padding-top: 184px;
padding-left: 255px;
}
div#img-3 {
position: fixed;
padding-top: 184px;
padding-left: 915px;
}
div#img-4 {
position: fixed;
padding-top: 184px;
padding-left: 585px;
}
div#img-5{
position: fixed;
padding-top: 184px;
padding-left: 1245px;
}
div#img-6 {
position: fixed;
padding-top: 184px;
padding-left: 1575px;
}
i know the code is bad but i hope someone can help me!
Here is a fiddle.
-Ryan
I looked at your external code. Please add your HTML and CSS to your question in Stack Overflow.
From the external HTML you have the following code:
<a>046-4524501</a>
Which does not work as a link.
You have this code
Home
That works as you would expect it to.
Change this line:
<a>046-4524501</a>
to
046-4524501
Where the href="Where you want the link to go".
It's all about the value for "href"
I did notice you are doing non-responsive html which means it is not mobile friendly or will look the same in smaller browser windows.
Your code is messy but your doing okay.
First off wrap everything you are putting in the header in the header div
The images are floating up to the top over your nav due to the position:fixed
Remove all the empty <p></p> between your div's
Use floats on your images and width of a percentage of 100% plus wrap them in a container/div
If you need me to I can see if I can redo all your html and CSS but think for you would learn better to try it out for yourself.
You could always go look at the HTML5 boilerplate out there and use them to guide you on how to construct good code.
I see that you are trying to create a row of images. Instead of using a system of DIVs why don't you use the more flexible (and more responsive) structure of a list?
Then you can use float: for lining them up in a row and basic CSS to give them sizes. The images will be specified as a background for these li elements (better practice).
Like this: http://codepen.io/Attrexx/pen/KVvwXP
You are placing divs containing the images using padding. That's why you can not use links in the menu. Div blocks cover your links.
Try using something like:
selector {
position: absolute; /* or `fixed` like in your css; see below*/
top: 100px; /* pixels from the top */
left: 100px; /* pixels from the left */
/* you can also use `bottom` and `right` */
}
For example:
div#img-3 { /* or just `#img-3`; see below */
position: absolute;
top: 184px;
left: 915px;
}
Check this w3 schools article for more information on positioning.
Not related to the question:
If you are using CSS's id selector (#), I suggest not to use element selector (e.g. div). So rather than div#img-3 try using just #img-3.
Try avoiding using id selectors at all. You can use class rules, and happily after some time they will result in saving you a lot of work.
If you are using HTML5 then try using semantic elements.
Avoid using fixed position when you don't need to (your page is an example of such page).
Paragraphs (p) shouldn't be used in the same way as div. It may result in bad habit for semantic sites.
Rather than using positioning (position), experiment with float or different display types (e.g. inline-block). Use it only when it is really needed.
Read about HTML Responsive Web.
ETA: Thanks for all the help, everyone! These all worked beautifully. Thanks so much for your time!
I'm coding a newsletter (live preview here and my goal for it here) and am trying to get the navigation buttons ('Join Meet Learn Support') to sit about halfway down the logo. When I try top-margin in the navButtons class I'm not seeing any success. I suspect it's a display issue, but I'm not sure --- changing from inline to inline-block didn't really help.
<!DOCTYPE html>
<html>
<head>
<title>The Leaflet</title>
<style>
div
{
display: inline;
}
a
{
text-decoration: none;
}
p
{
text-align:left;
margin-left: 130px;
margin-right: 130px;
max-width: 600px;
}
#logo /* This sets the width for the New Leaf logo at the top. This should not change.*/
{
position:relative;
}
#navButtons
{
position:relative;
right:-240px;
}
#announcementImage
{
margin-left: 120px;
margin-right: 120px;
}
a.joinButton
{
margin-left:40%;
color:white;
background-color: #f7853e;
font-size: 30px;
}
a.navButton
{
color:#494541;
font-size: 22px;
}
</style>
</head>
<body>
<div id="logo"> <! --- Sets up the logo --->
<img src ="images/NLNewsletterLogo.png">
</div>
<div id="nav buttons"> <! --- Navigation Bar--->
<a class = "joinButton" href="url">Join</a>
<a class = "navButton" href="url"> Meet </a>
<a class = "navButton" href="url">Learn </a>
<a class = "navButton" href="url">Support </a>
</div>
<br>
<br>
<br>
<br>
<br>
<div id ="announcementImage"><! --- Lead Image-->
<img src="images/announcementGraphic.png">
</div>
<div id = "announcementText">
<p>Thrive Week is in full swing here at the Leaf. So far, we've had Sharon Perry, head of the State
College Area School District Career Center, help participants identify which of 34 traits,
including the special quality of woo, are strengths they employ in various settings so they can
work smarter. Then Anna Gokieli, owner of Tru Meditation and Yoga, got us staying present and
peaceful even in situations that often trigger stress. Will Snyder brought it home last night by
showing how making art and making money don't have to conflict.
Have a comment on a workshop you've attended or a session you'd like to see in our remaining
Design and Launch weeks? Galen would love to hear from you!</p>
</div>
</body>
Try this
#logo {
display: inline-block;
vertical-align: middle;
}
#nav {
display: inline-block;
vertical-align: middle;
width: 100%;
}
I think what your looking for is:
#logo {
vertical-align: middle;
}
Try adding bottom of something like 60px to div with id nav buttons.
Since this element is position: relative, it's placement can be controlled with left, right, top, bottom, like so:
#nav#buttons {
bottom: 50px;
}
Floating the logo left, and adding margin to the #nav will do the trick.
#logo { float: left; }
#nav {margin-top: 80px; width: 100%; display: inline-block; }
h1.title { clear: left; }
You're almost there. Inline-Block is what I'd use with absolute positioned nav, but you have a generic div {position:inline;} that applies to everything on the page inside of a div. You should be more specific for your logo and nav and just get rid of the generic styling by giving each a class like <div class="WHATEVER"> so you can target the div you want to work on.
Then try this:
#logo {
width: 240px;
display: inline-block;
#nav buttons {
margin: 0px 0px 0px 80px;
display: inline-block;
position: absolute;
top: 80px;}
It looks like my styling in Google Chrome isn't quite working out as I have intended (link). It works just fine on Internet Explorer 8.
Here's the style sheet:
#charset "utf-8";
/* Stylesheet for Northview Game Tickets */
#mainwrapper {
width:18cm;
height:25cm;
background-color:#0F0;
}
#title {
width:680px;
height:117px;
/*background-image:url(http://nhswag.com/tickets/images/title.png);*/
background-color:#183f61;
}
#title-img {
width:680px;
height:117px;
}
#sportimage {
width:680px;
height:302px;
background-image:url(http://nhswag.com/tickets/images/sportimg.png);
}
#instructionstitle {
width:340px;
height:57px;
float:left;
padding-top:15px;
/*background-color:#353435;*/
background-color:#183f61;
vertical-align:text-bottom;
color:#FFFFFF;
}
#instructions {
width:340px;
height:416px;
float:left;
text-align:left;
padding-top:15px;
/*background-color:#8B8B8B;*/
/*background-color:#003;*/
background-color:#F2EEEA;
}
#ticketinfo {
width:170px;
height:189px;
float:right;
text-align:left;
padding-top: 15px;
padding-left: 15px;
/*background-color:#767676;*//*#633;*/
background-color:#d9d5d2;
}
#barcodewrapper {
width:170px;
height:189px;
float:right;
padding-top:44px;
/*background-color:#767676;*//*#FFF;*/
background-color:#d9d5d2;
}
#barcode {
border-width:thick;
border-color:#000;
}
#adspace {
width:340px;
height:284px;
float:right;
padding-top:10px;
background-image:url(http://nhswag.com/tickets/images/ad.png);
}
#copyrightwrapper {
width:680px;
height:57px;
padding-top:25px;
background-color:#183f61;
font-size:12px;
color:#FFFFFF;
}
What style option may be causing the inconsistencies?
EDIT:
Page source:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="ticketstyle.css" />
<title>NHSWAG Game Ticket</title>
</head>
<?php
/*
Required Fields:
1) name
2) type (adult/student/child)
3) price
4) barcodeid
ex: http://nhswag.com/tickets/ticketprint.php?name=John%20Smith&type=Adult&price=4.98&barcodeid=9780618503049
*/
function google_qr($url,$size ='150',$EC_level='L',$margin='0') {
$url = urlencode($url);
echo '<img id="barcode" src="http://chart.apis.google.com/chart?chs='.$size.'x'.$size.'&cht=qr&chld='.$EC_level.'|'.$margin.'&chl='.$url.'" alt="QR code" width="'.$size.'" height="'.$size.'"/>';
}
?>
<body style="background-color:#b0b0b0">
<center>
<div id="mainwrapper">
<div id="title">
</div>
<div id="sportimage">
sportimage
</div>
<div id="instructionstitle">
Instructions</div>
<div id="ticketinfo">
<strong>Ticket Details:</strong><br><br>
Name:<br>
<?php echo $_GET["name"]; ?><br>
Type:<br>
<?php echo $_GET["type"]; ?><br>
Price:<br>
$<?php echo $_GET["price"]; ?>
</div>
<div id="barcodewrapper">
<center>
<div id="barcode">
<?php google_qr('http://www.nhswag.com/tickets/check/ticketcheck.php?barcodeid='.$_GET["barcodeid"],100); ?>
<?php // echo md5("JustianMeyerNorthview Gwinett Football"); ?>
</div>
</center>
</div>
<div id="instructions">
<ol>
<li>Print this ticket and keep it for your records.</li>
<li>Present this ticket at the entrance of your <strong>Northview High School</strong> sponsored event.</li>
<li>Enjoy! Ask the ticket manager for seating.</li>
</ol>
</div>
<div id="adspace">
<p>Advertisement</p>
<p> </p>
</div>
<div id="copyrightwrapper">
Copyright © NHSwag Team, 2011
</div>
</div>
</center>
</body>
</html>
Your page is rendering in Quirks mode in IE8:
Quirks mode is a rendering mode used
by some web browsers for the sake of
maintaining backward compatibility
with web pages designed for older
browsers or coded without standards
conformance.
You can't hope that a page which is created to work in IE Quirks mode will work in any other browser - it almost always won't, as it the case here.
So, you should change the doctype (first line) to <!DOCTYPE html> to get it out of Quirks mode and fix the (numerous) problems from there.
If you need more advice on how to fix your HTML/CSS to work with a proper doctype, let me know and I'll provide a more thorough answer on how to do this.
I tested this in IE7/8, Firefox, Chrome: it renders consistently.
I tried to keep as much of your HTML/CSS as possible; because I did that, the code could be more elegant, but it works!
I added all the styles at the top just to make it easier to test; you should put them in your stylesheet.
You will have to add back in your PHP where appropriate. I added in one tiny snippet of PHP to output the current year.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>NHSWAG Game Ticket</title>
<style type="text/css">
html, body {
margin: 0;
padding: 0;
border: 0
}
body {
background: #b0b0b0;
padding: 5px
}
#mainwrapper {
width: 680px;
margin: 0 auto
}
#title {
height: 117px;
/*background-image:url(http://nhswag.com/tickets/images/title.png);*/
background-color: #183f61;
}
#sportimage {
height: 302px;
background-image: url(http://nhswag.com/tickets/images/sportimg.png);
}
#floatContainer {
background: #f2eeea;
overflow: auto
}
#left {
float: left;
width: 50%
}
#right {
float: right;
width: 50%
}
#instructionstitle {
height: 32px;
padding-top: 12px;
/*background-color: #353435;*/
background-color: #183f61;
vertical-align: text-bottom;
color: #fff;
text-align: center
}
#barcodewrapper {
overflow: auto;
background: #d9d5d2
}
#barcode {
float: left;
padding: 20px
}
#ticketinfo {
float: left;
padding: 16px 0
}
#ticketinfo dd {
margin-left: 12px
}
#ticketinfo dl {
margin: 0
}
#copyrightwrapper {
height: 35px;
padding-top: 22px;
background-color: #183f61;
font-size: 12px;
color: #fff;
text-align: center
}
#adspace {
height: 284px;
background: #fff;
text-align: center;
background:url(http://nhswag.com/tickets/images/ad.png) no-repeat
}
#adspace p {
margin: 0;
padding: 12px 0
}
</style>
</head>
<body>
<div id="mainwrapper">
<div id="title">title</div>
<div id="sportimage">sportimage</div>
<div id="floatContainer">
<div id="left">
<div id="instructionstitle"> Instructions </div>
<div id="instructions">
<ol>
<li>Print this ticket and keep it for your records.</li>
<li>Present this ticket at the entrance of your <strong>Northview High School</strong> sponsored event.</li>
<li>Enjoy! Ask the ticket manager for seating.</li>
</ol>
</div>
</div>
<div id="right">
<div id="barcodewrapper">
<div id="barcode"> <img id="barcode" src="http://chart.apis.google.com/chart?chs=100x100&cht=qr&chld=L|0&chl=http%3A%2F%2Fwww.nhswag.com%2Ftickets%2Fcheck%2Fticketcheck.php%3Fbarcodeid%3D" alt="QR code" width="100" height="100"/> </div>
<div id="ticketinfo"> <strong>Ticket Details:</strong><br>
<br>
<dl>
<dt>Name:</dt>
<dd>John Smith</dd>
<dt>Type:</dt>
<dd>Student</dd>
<dt>Price:</dt>
<dd>$5</dd>
</dl>
</div>
</div>
<div id="adspace">
<p>Advertisement</p>
<p> </p>
</div>
</div>
</div>
<div id="copyrightwrapper"> Copyright © NHSwag Team, <?php echo date('Y') ?></div>
</div>
</body>
</html>
It's because of IE's default box-sizing (which is non-w3c compliant, BTW, and it's Chrome that's working correctly) when it is in Quirks Mode.
Try this:
#ticketinfo {
width:170px;
height:189px;
float:right;
text-align:left;
padding-top: 15px;
/*padding-left: 15px;*/
/*background-color:#767676;*//*#633;*/
background-color:#d9d5d2;
}
In IE the element's width is 170px, in Chrome: 170px + 15px padding.
But what you REALLY should do is to use a correct doctype.
his problem cause by different block model implementation between ie and chrome/firefox/opera (w3c) which ie9 now already comply with standard. I have tested with IE8 and chrome. simple fix:
#copyrightwrapper {
width: 680px;
height: 57px;
padding-top: 25px;
background-color: #183F61;
font-size: 12px;
color: white;
clear: both; /*add this to make sure footer is in the bottom as u use float before*/
}
then remove unnecessary padding-top from other float div