-ms-overflow-x property
[This documentation is preliminary and is subject to change.]
Sets or retrieves how to manage the content of the object when the content exceeds the width of the object.
Syntax
-ms-overflow-x: visible | scroll | hidden | auto
Property values
visible-
Default. Content is not clipped and scroll bars are not added. Elements are clipped to the size of the containing window or frame.
scroll-
Content is clipped and scroll bars are added, even if the content does not exceed the dimensions of the object.
hidden-
Content that exceeds the dimensions of the object is not shown.
auto-
Content is clipped and scrolling is added only when necessary.
CSS information
| Applies To | All elements |
|---|---|
| Media | visual |
| Inherited | no |
| Initial Value |
Standards information
There are no standards that apply here.
Remarks
Windows Internet Explorer 8. The -ms-overflow-x attribute is an extension to CSS, and can be used as a synonym for overflow-x in IE8 Standards mode.
With Microsoft Internet Explorer 6 and later, when you use the !DOCTYPE declaration to specify standards-compliant mode, this property applies to the html object.
See also
- CSSStyleDeclaration
- currentStyle
- defaults
- runtimeStyle
- style
- Reference
- overflow
- -ms-overflow-y
- position
- Other Resources
- CSS Enhancements in Internet Explorer 6
Build date: 3/14/2012
quickfix for previous problem.
<html>
<head>
<title>overflow-x quickfix</title>
<script type="text/javascript">
<!--
function check_div(){
//Detect user agent
if(navigator.userAgent.toLowerCase().indexOf("msie") != -1) isIE = true;
else isIE = false;
if(isIE){// If using IE
eldiv = document.getElementsByTagName("div");// Find all div elements on page
for(i in eldiv){// Go throu every found div element
if(eldiv[i].clientHeight < eldiv[i].scrollHeight){// If displayed element height is less than scrollable height
var diff = eldiv[i].scrollHeight - eldiv[i].clientHeight;// Find difference of heights
eldiv[i].style.height = eldiv[i].offsetHeight + diff;//Change element height
}
}
}
}
-->
</script>
</head>
<body onLoad="check_div();">
<div style="border: 1px dotted black; width: 200px; overflow-x: auto;">
<pre style="margin-top: 0px; margin-bottom: 0px;">
test test test test test test test test test test test test
test test test test test test test test test test test
test test test test test test test test test test test test
</pre>
</div>
<div style="border: 1px dotted black; width: 200px; overflow-x: auto;">
<pre style="margin-top: 0px; margin-bottom: 0px;">
test test test test
test test test
test test test test
</pre>
</div>
</body>
</html>
Should fix IE problem on "overflow-x: auto;" case when there is text overflow detected and scrollbar is showed over text.
I'm trying to make alternative to code tags with white spaces, this code section is not limited by height, but it has limited width and in cases when text goes outside width limits there is need after scrollbar. For example:
<div style="border: 1px dotted black; width: 200px; overflow-x: scroll;"> <pre style="margin-top: 0px; margin-bottom: 0px;"> test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test </pre> </div>Works as I need in cases if text is longer that browser can show, but if there is short text and no need to show scrollbar, it shows inactive scrollbar, all browsers that I've tested with, shows inactive scrollbar.
So I tryed to set "overflow-x: auto", works well on FF, Opera, Safari and Chrome, BUT on IE7 and IE8beta2 there is anoying thing, that in cases when there is need after scrollbar, last row of text goes under scrollbar.
Any suggestions?
Sorry for my bad english...
- 1/23/2009
- Tower_9