liamC
Member
Registered: 28th Feb 04
User status: Offline
|
Have an image sitting inside a div, but IE8 & 9 keep putting a vertical scrollbar on the side, for no reason whatsoever.
Code is as follows:
---
HTML
<div id="imagecontainer">
<img src="image.png">
</div>
CSS
#imagecontainer{width:400px; overflow: auto;}
---
Any ideas what I can do to get rid of this daft scrollbar? It is fine in every other browser and version other than IE 8 & 9.
|
Neil
Member
Registered: 2nd Nov 03
Location: Newcastle Drives: E46 MSport Coupe
User status: Offline
|
overflow:auto will put a scrollbar on the div if the image is larger than 400px wide...
http://www.w3schools.com/css/pr_pos_overflow.asp
[Edited on 26-06-2011 by NeilM]
|
Dom
Member
Registered: 13th Sep 03
User status: Offline
|
quote: Originally posted by NeilM
overflow:auto will put a scrollbar on the div if the image is larger than 400px wide...
http://www.w3schools.com/css/pr_pos_overflow.asp
As Neil said, use Overflow: hidden; if you want to disable scrollbars on a div.
Edit - Also make sure you have !DocType sorted, that can cause overflow issues in IE8. Likewise div position.
[Edited on 26-06-2011 by Dom]
|
liamC
Member
Registered: 28th Feb 04
User status: Offline
|
Sorry, made a mistake on the code - There is no specific height or width set, just overflow: auto, and to float:right
|
Neil
Member
Registered: 2nd Nov 03
Location: Newcastle Drives: E46 MSport Coupe
User status: Offline
|
visible The overflow is not clipped. It renders outside the element's box. This is default
hidden The overflow is clipped, and the rest of the content will be invisible
scroll The overflow is clipped, but a scroll-bar is added to see the rest of the content
auto If overflow is clipped, a scroll-bar should be added to see the rest of the content
inherit Specifies that the value of the overflow property should be inherited from the parent element
Use visible or hidden to not have scroll bars on the div.
If the size of the image changes (uses different images), just use float:right... shouldn't need any other styling. Was there a reason for wanting to use overflow?
[Edited on 26-06-2011 by NeilM]
|
liamC
Member
Registered: 28th Feb 04
User status: Offline
|
Thanks, this overflow was the issue. Have changed it to hidden.
Just in case this is of help to people, and I am probably years behind the normal world, I have came across Adobe Browser Labs to test across all browsers - well worth it for web people
https://browserlab.adobe.com
|