tags:

views:

318

answers:

11
+2  Q: 

CSS issue with IE

Please check this:

http://img62.imageshack.us/img62/3598/ieff.png

why is it more height than in FF.. i want it to be like FF in IE

#message2 {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 105; 
    background-color: #034678;
    font-family: Arial,Helvetica,sans-serif;
    font-size: 100%;
    text-align: center;
    font-weight: bold;
        border-bottom: 2px solid #FFF;
  height: 26px;
  width: 100%;
} 

<div class="message2" id="message2" onclick="closeNotice2()" style="display: none">
Yo, <b><? echo $pusername; ?></b> - <? echo $_SESSION["user_message"]; ?> 
<a class="close-notify" onclick="closeNotice2()">X</a>
</div> 

When i change the size of height, It changes in FF but in IE it remains the same size..?

A: 

We don't know what your #message markup looks like. Is it an H1 or H2 or something like that? If so, you may want to reset such container styles to have margin: 0 and padding: 0. Different browsers interpret those tag-soup elements in different ways.

Robusto
My #message is a <div>.., it's in the question
Karem
It wasn't in the question when I read it. You must have added it in your edit.
Robusto
A: 

internet explorer mostly has these errors when in quirksmode. do you have a valid doctype? use the w3c's validator:

http://validator.w3.org

edit:

please try to delete unneeded blanks and new-lines.

<div class="message2" id="message2" onclick="closeNotice2()" style="display: none">Yo, <b><? echo $pusername; ?></b> - <? echo $_SESSION["user_message"]; ?> <a class="close-notify" onclick="closeNotice2()">X</a></div> 
henchman
No errors in validator
Karem
I tried this also, still nothing :(
Karem
please show us the complete sourcecode for further elaboration
henchman
complete sourcecode for what? all my php coding? but thats not relevant
Karem
sorry - only the relevant html and css of course :-)
henchman
well all should already be there, my friend..
Karem
ehmm... like between doctype and </html> :-), including all styles
henchman
A: 

I second for the <! DOCTYPE at the first line of your HTML file. Without it, I get erratic behaviours between IE and FF.

Graveen
this should be a comment
codedude
Too bad Stack Overflow won't let you post comments below a certain reputation treshold.
janmoesen
+1 because it annoys me when people downvote just because someone (with rep < 50) uses an answer as a comment.. :)
Stein G. Strindhaug
Getting 100 rep is instant if you do the right stuff with your account...agree on the bad downvotes, also duplicate answers should NOT be downvoted just because they are duplicates - some do that just so their answers raise higher.
Mark Schultheiss
+2  A: 

Internet Explorer has a very nasty quirks mode which activates when your web page seems to disobey the W3C standards. In quirks mode, Internet Explorer tends to render things just a (big) bit different than other browsers (to keep compatibility with older websites which where written specifically for Internet Explorer's weird rendering engine). One way to let Internet Explorer think that your web page actually conforms to the standards is to insert a DOCTYPE as the very first line in each web page.

For an XHTML web page, the doctype could be:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;

For a HTML 4.0 web page, it could be:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
Virtlink
wont work either, i already have this
Karem
@Azzyh: which one?
Chris Lively
Also you should use Strict mode, not transitional. There are still plenty of differences in browser implementations of the mentioned doctypes.
Chris Lively
+2  A: 

IE will not not respect your height by default if the content overflows the container. You can add overflow: hidden to make it work like FireFox.

There must be some other styles affecting this. For starters, you don't show us the styles that change the color of the text, and I suspect there is styling of the link.

Marc
+5  A: 

Did you try adding a line-height to your css?
Also a css reset might help with the default margin and padding.

Knu
+1 for the CSS reset. That solves 90% of cross-browser CSS sizing issues.
Jacob
+1 I agree with Jacob. This will generally solve most of your CSS issues.
blesh
A: 

Add "overflow:hidden;" just in case the content is stretching the div and remove any whitespace between the closing div tag here and the next element in your page. Browsers should really ignore whitespace in between elements, but in practice I have found that's not the case.

Bob Ralian
A: 

Try adding:

zoom: 1;

to the css. That will sometimes make IE force the element to hasLayout...

Chibu
A: 

Which version of IE you are using? IE6 and IE8 makes a big difference, yo. Also, without complete HTML / CSS source code and/or public URL this is difficult to resolve. I would try to track down the issue using IE's Developer Toolbar, which must be downloaded and installed manually for IE6/7.

jholster
A: 

i would try setting display:inline

Either set it on the div it self, of on the content of the div. You may need to wrap the content into another tag such as span.

But like many a person has said, you need to provide more. more code. more picutre. more information.

thecoshman
A: 

I have used this reset with success when having issues of this nature:

CSS reset discussion

Mark Schultheiss