Click to See Complete Forum and Search --> : Website does not look the same in IE7 as in Firefox...
MooMoo
11-13-2008, 12:43 PM
Hi all,
This is my first post here and pretty much my first venture into any sort of web development. To say that I am finding it challenging and rewarding, even after a few days, is to do a great disservice to how I really feel. :)
One of the challenges I am up against right now is that my website looks fine in Firefox (how I designed it) but not in IE7.
The issue is that it will not center on the page in IE7. I am experimenting with the look where the center of the page has all the info, and the right and left sides are either blank, or a place where secondary and tertiary information would go (or ads, in the future).
Please keep in mind what I said - I am VERY green to web development, so please take it easy on me and use mostly layman's terms in your advice. :o Thanks!
Code:
<html>
<head>
<style type="text/css">
body {background-image: url(http://www.ilyapitin.com/bluegradient.jpg);}
body {font-family:"Comic Sans MS"}
#container { /* this is the holder for the page content */
width: 675px;
border: 2px solid #616D7E;
background-color: #616D7E;
padding: 3px; /* pad the content a little */
margin: 0px auto; /* this centers the container */
}
#header { /* this affects the whole header */
font-family:"Comic Sans MS"
font-style: italic;
background-color: #56A5EC;
}
#header h1 { /* this only affects any h1 tags within the header */
margin: 0; /* remove extra margin from h1 */
padding: 0; /* remove extra padding from h1 */
border-bottom: 1px dotted #616D7E; /* bottom border of header */
font-weight: normal; /* remove bold from h1 tag */
text-align: center; /* center the text */
}
#footer {
border-top: 1px dotted #616D7E; /* top border of footer */
font-size: 60%; /* make the text smaller than body */
color: #616D7E; /* set the text color to gray */
text-align: right; /* right justify the text */
}
#footer a {
text-decoration: none;
border-bottom: 1px dotted #999; /* shorthand for #999999 */
color: #999;
}
#footer a:hover { border-bottom-style: solid; }
-->
</style>
<style type="text/css" media="print">
<!--
footer { display: none; }
-->
</style>
</head>
<body>
<div id="container">
<div id="header">
<h1>www.ilyapitin.com</h1>
</div>
This website will become a testbed for my continuing self-education of web development and programming.
It is currently in its extreme infancy period, and will be changing weekly, if not daily.
<p>The main goal of this page is to, in due time, showcase my skills and abilities using multiple languages.
<p> These languages will include, and aren't limited to:
<li>HTML</li>
<li>CSS</li>
<li>XML</li>
<li>JavaScript</li>
<li>Java</li>
<li>etc.</li>
<p>
I will try and keep a running diary of my accomplishments, triumphs, ideas, and failures. Hopefully not so many failures...
<p>
Also, being a lover of photography, I will be putting up some pictures and perhaps a story or two about them, but this will be a secondary part of the site.
</ul>
</div>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>Basic centering</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
#centered {text-align:center;}
#container {margin:0 auto; width:80%; text-align:left;}
</style>
</head>
<body>
<!-- Center contents -->
<div id="centered"><div id="container">
<div id="contents" style="border:1px solid red;">
<p>contents</p>
</div>
</div></div>
</body>
</html>
</body>
</html>
Shorts
11-13-2008, 12:55 PM
Well some minor problems, your page in IE7 is going into Quirks mode, so anything can happen.
First off, I'd say make all your HTML valid, meaning make sure all tags are opened and closed properly. For example, your P's are opened yet not closed, and the </ul> is misplaced with no opening <ul>. After that, tell the browser what version of (x)HTML you are using.
e.g.
<!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" dir="ltr" lang="en">
<head>
<title>Page Title</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<style type="text/css">
body {background-image: url(http://www.ilyapitin.com/bluegradient.jpg);}
body {font-family:"Comic Sans MS"}
#container { /* this is the holder for the page content */
width: 675px;
border: 2px solid #616D7E;
background-color: #616D7E;
padding: 3px; /* pad the content a little */
margin: 0px auto; /* this centers the container */
}
#header { /* this affects the whole header */
font-family:"Comic Sans MS"
font-style: italic;
background-color: #56A5EC;
}
#header h1 { /* this only affects any h1 tags within the header */
margin: 0; /* remove extra margin from h1 */
padding: 0; /* remove extra padding from h1 */
border-bottom: 1px dotted #616D7E; /* bottom border of header */
font-weight: normal; /* remove bold from h1 tag */
text-align: center; /* center the text */
}
#footer {
border-top: 1px dotted #616D7E; /* top border of footer */
font-size: 60%; /* make the text smaller than body */
color: #616D7E; /* set the text color to gray */
text-align: right; /* right justify the text */
}
#footer a {
text-decoration: none;
border-bottom: 1px dotted #999; /* shorthand for #999999 */
color: #999;
}
#footer a:hover { border-bottom-style: solid; }
-->
</style>
<style type="text/css" media="print">
<!--
footer { display: none; }
-->
</style>
</head>
<body>
<div id="container">
<div id="header">
<h1>www.ilyapitin.com</h1>
</div>
<p>This website will become a testbed for my continuing self-education of web development and programming.
It is currently in its extreme infancy period, and will be changing weekly, if not daily.</p>
<p>The main goal of this page is to, in due time, showcase my skills and abilities using multiple languages.</p>
<p>These languages will include, and aren't limited to:</p>
<ul>
<li>HTML</li>
<li>CSS</li>
<li>XML</li>
<li>JavaScript</li>
<li>Java</li>
<li>etc.</li>
</ul>
<p>I will try and keep a running diary of my accomplishments, triumphs, ideas, and failures. Hopefully not so many failures...</p>
<p>Also, being a lover of photography, I will be putting up some pictures and perhaps a story or two about them, but this will be a secondary part of the site.</p>
</div>
</body>
</html>
That should work, didn't check. But pretty much what I did was made sure all the tags were correct and then told the browser what type of document it is by changing <html> to :
<!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" dir="ltr" lang="en">
And then adding this meta tag in the head section:
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
When it comes to validation, http://validator.w3.org/ will be your bestest friend. With (x)HTML and CSS.
OctoberWind
11-13-2008, 12:59 PM
Well, first and foremost, you need a DocType. Most modern browsers will work and display fine w/o a doctype, but they run in "quirks" mode, where the browsers makes (often wrong) assumptions about what the code is supposed to mean. IE7 is no exception.
The most common for general web is the HTML 4.01 Transitional:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
Try this first, and all ways get in the habit of validating your code.
http://validator.w3.org/
(edit: and Shorts beat me to it, with a little extra detail...)
MooMoo
11-13-2008, 01:06 PM
Wow, Shorts, that worked perfectly. What do you think it was? The incorrect tags (not closing <p>) or the telling the browser what kind of doc it is?
Thank you!!
MooMoo
11-13-2008, 01:07 PM
Well, first and foremost, you need a DocType. Most modern browsers will work and display fine w/o a doctype, but they run in "quirks" mode, where the browsers makes (often wrong) assumptions about what the code is supposed to mean. IE7 is no exception.
The most common for general web is the HTML 4.01 Transitional:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
Try this first, and all ways get in the habit of validating your code.
http://validator.w3.org/
(edit: and Shorts beat me to it, with a little extra detail...)
Ha, shows what I know... I didn't know about quirks mode AND I left out the DOCTYPE on purpose. Thank you. :) So much to learn... :)
MooMoo
11-13-2008, 01:10 PM
By the way, tomorrow I will be receiving two books to help me along with my self-learning:
1. Head First HTML with CSS & XHTML by Eric Freeman and Elisabeth Freeman
2. JavaScript: The Definitive Guide by David Flanagan
Anything else I should pick up immediately to start my studies? I want my website to look great, and I want to learn how to do that. I understand that my current site is extremely basic (and maybe some of you are thinking "seriously? this is his first go at it?") so I want to improve, and fast. I want it to look like Flickr (same kind of style/outlook) and I want to build it from the ground up (no templates or shortcuts).
Thank you all again!
Shorts
11-13-2008, 01:29 PM
Nice, glad it worked out and OctoberWind helped with the Quirks mode explanation.
For now I'd suggest getting very solid with HTML 4.01 (or XHTML 1.0) and CSS. Like ridiculously solid. Good that you want to start from the ground up, might take a bit longer but will help greatly in the end. And don't worry about what type of site or how simple it is, everyone started somewhere. Mine was an ugly Final Fantasy 1-6 site... trust me, it was ugly as sin (also it was October '97 so yeah).
After you have a good structure with HTML\CSS then depending on what you want to do is where you should go next. If you want to utilize dynamic content then you're going to have to jump into a server side programming language (suggest PHP, its simple and well documented online, there are plenty of alternatives though and it'll just come down to preference).
So, HTML\CSS first. Then if dynamic content its PHP\MySQL (they go together similar to HTML\CSS), if not dynamic content then sure jump on with some JavaScript.
Dynamic content by the way means content that is changed on the fly. Stuff like blogs, bulletin boards, polls, etc.
OctoberWind
11-13-2008, 03:50 PM
One book i found to be really helpful is Transending CSS by Andy Clarke (http://transcendingcss.com/).
It assumes you know the basics of html/css, but is still does a good job of explaining how/why.
Also, another thing I like to do is browse the HTML/CSS forms here, and see if I can work through some of the problems before reading on to see what the "resident experts" have to say. You would be surprised what tips and tricks you can learn by reading other's problems.
Shorts
11-13-2008, 04:40 PM
Good additions.
Most I've learned have been from online references (and other people's HTML\CSS).
Some good sites:
This is has a great Float tutorial: http://css.maxdesign.com.au/floatutorial/index.htm
They also have a great Menu tutorial: http://css.maxdesign.com.au/listutorial/index.htm
And examples (same HTML code for all of these lists, just different CSS: http://css.maxdesign.com.au/listamatic/index.htm
And a decent quick reference site:
http://www.w3schools.com/
MooMoo
11-13-2008, 06:22 PM
Nice, glad it worked out and OctoberWind helped with the Quirks mode explanation.
For now I'd suggest getting very solid with HTML 4.01 (or XHTML 1.0) and CSS. Like ridiculously solid. Good that you want to start from the ground up, might take a bit longer but will help greatly in the end. And don't worry about what type of site or how simple it is, everyone started somewhere. Mine was an ugly Final Fantasy 1-6 site... trust me, it was ugly as sin (also it was October '97 so yeah).
After you have a good structure with HTML\CSS then depending on what you want to do is where you should go next. If you want to utilize dynamic content then you're going to have to jump into a server side programming language (suggest PHP, its simple and well documented online, there are plenty of alternatives though and it'll just come down to preference).
So, HTML\CSS first. Then if dynamic content its PHP\MySQL (they go together similar to HTML\CSS), if not dynamic content then sure jump on with some JavaScript.
Dynamic content by the way means content that is changed on the fly. Stuff like blogs, bulletin boards, polls, etc.
Thank you for that. I'm not quite sure where I want to take my website, but I do want to become a web developer/coder/programmer as a career, so the books and practice (building from the ground up) will really help with that, I think. Of course, along the way if I can make a decent website for myself that would be great. :)
MooMoo
11-13-2008, 06:24 PM
One book i found to be really helpful is Transending CSS by Andy Clarke (http://transcendingcss.com/).
It assumes you know the basics of html/css, but is still does a good job of explaining how/why.
Also, another thing I like to do is browse the HTML/CSS forms here, and see if I can work through some of the problems before reading on to see what the "resident experts" have to say. You would be surprised what tips and tricks you can learn by reading other's problems.
Thanks, OW, I'll look into that book after I get a firmer grasp on the basics of HTML/CSS. I have been browsing this site for the past day or so and really like it - lots of questions and problems solved that I would probably run into at some point. I'll try it your way to get better use out of the posts.
MooMoo
11-13-2008, 06:26 PM
Good additions.
Most I've learned have been from online references (and other people's HTML\CSS).
Some good sites:
This is has a great Float tutorial: http://css.maxdesign.com.au/floatutorial/index.htm
They also have a great Menu tutorial: http://css.maxdesign.com.au/listutorial/index.htm
And examples (same HTML code for all of these lists, just different CSS: http://css.maxdesign.com.au/listamatic/index.htm
And a decent quick reference site:
http://www.w3schools.com/
Awesome, thanks Shorts! Those will definitely come in handy immediately for me and my website.
By the way, I had some time to adjust/add some things on the website. It's still very plain-jane, but I like the color scheme better and there's more than just 5 lines of text now. :)