Ive just started playing around with CSS. Im designing it generally for Firefox however every so often I look at my design in IE.
In firefox everything looks as it should whereas in internet explorer its all over the place...
Either Im coding my CSS wrong or this is just another reason why people prefer firefox to ie...
Comments
If you're using floated divs instead of tables, you might find that it does look a bit iffy in IE but it'll be fine in other browsers.
The easiest way to fix this is to modify the floated div so that instead of looking like:
[html]<div class="myclass">[contents]</div>[/html]
It looks like:
[html]<div class="myclass" style="display: inline;">[contents]</div>[/html]
For some reason, you need to set it's display property to inline in order for it to work with IE as it should.
This doesn't break your code at all, so you don't have to worry about messing up your code so much
If that doesn't help, I'd suggest looking on google for sites like http://www.positioniseverything.net/ (poorly designed, but has a good number of browser bugs listed and how to get around them).
Current project: CMS Object.
Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in.
Release date: NEVER!!!
Ive got in the style:
[HTML]div.container
{
position:relative;
width: 760px;
height: 100%;
border-left: 0.5px solid #999999;
border-right: 0.5px solid #999999;
background-color: white;
margin-left: auto;
margin-right: auto;
}
div.header
{
width: 760px;
height: 60px;
background-image: url(templates/images/header_bg.jpg);
background-repeat: x;
margin-left: auto;
}[/HTML]
Then [HTML]<div class="container">
<div class="header">
<a href="index.php"><img src="templates/images/logo.jpg" border="0"></a>
</div>
</div>[/HTML]
looks fine in firefox but in ie everything is on the left hand side instead of center of page. and if i set the display to inline then in ie it stays the same but in firefox it throws everything off...
The Royal Ram
If you want to center a site, you should use position: absolute; since position: relative; only positions things relative to their origional place within the document.
For example, if you had a site that was something like 622 pixels wide, you would do something like this:
You should be able to center your template with absolute positioning, but don't use it for content inside a div or other html element since it won't work in any browser.
In those situations, you'd use relative positioning.
Current project: CMS Object.
Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in.
Release date: NEVER!!!
Is there a better way than just guessing the left and right percentages?
The Royal Ram
The Royal Ram
If you used pixel widths, you'd be really stuck since you'd have to know what resolution the user had in order to tell how many pixels in width theier system was set to.
If you were using fluid design (a design that can stretch and squash to fit the size of the window it's viewed in), you'd have less guess work since all you'd have to do is subtract the width (lets say it's 50%) from 100 and then divide what's left by 2... something like:
(100 - 50) / 2 = 25 (or 100 - 50 = 50, 50 / 2 = 25).
If you're going to have a border of any width, you should take into account that it may slightly change things since you're adding usually to the width of the item you're adding it to.
You only really need to know the left percentage really with fixed width templates since the right percentage can't effect the width like it can with fluid templates, but I just put it in just in case
Current project: CMS Object.
Most recent change: Theme support is up and running... So long as I use my theme resource loaders instead of that in the Rails plug-in.
Release date: NEVER!!!
Its annoying... IE cant use 0.5px borders
Positioning in CSS is really annoying...
The Royal Ram
The centering problem is just because IE doesn't know what 'auto' means with 'margin'. You need to have one wrapper div that has a width of 100%, but with 'text-align' to center -- this will center the content within with IE. Then another wrapper the sets the width of your page, and resets 'text-align' to left.
Webmaster-Talk.com
Chroder.com
Didnt think of that. Thanks
The Royal Ram
for those who are very good at css, they'll probably prefer ff...