473,322 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Literal Text control and IE - disappearing text bug

In case anyone hasn't seen this problem, just sharing the info....

I created a dotnet 1.1 page with a literal control. I used a
streamreader to open a text file to fill the control. I filled the
control on page load.

When viewing the page in IE 6.0, sometimes the literal control did not
display all of the text. Refreshing the page (via browser refresh
button) would cause random results; sometimes more text, sometimes less
(whole paragraphs missing), sometimes partial height lines, etc.

At first, I thought this was some kind of buffering problem, or a
timing issue with the streamreader. Then I tested with Netscape 7.1 and
Mozilla 1.75 - same pages displayed perfectly with no problem.

The true problem was the old and well-known IE positioning bug.
Essentially, as I understand it, it boils down to a "div" element that
doesn't have a fixed size (height/width); IE has trouble displaying
them. The Literal Text control renders as a "div" element. When I
applied the "Hollyhack" fix
(http://www.positioniseverything.net/...ollyhack.html), the
problem VANISHED.

In case the above link breaks, here is the relevant section from the
Hollyhack page:
*******************************************
"....The following code is an instance of the Holly hack. Primarily,
the Holly hack consists of a set of hiding methods wrapped around that
1% height, which is the key to the hack. Remember, the whole idea is to
let IE/Win and only IE/Win see that height and apply it to the buggy
box.

/* Hides from IE5-mac \*/
* html .buggybox {height: 1%;}
/* End hide from IE5-mac */

Code Block 1

Two Hacks in One: The first line of code is a CSS comment with an
"escape" (colored red) just before the comment closing tag. The
presence of that escape character causes IE5/Mac to ignore the closing
tag of the comment, and think that the comment is still active. Thus,
it ignores everything until it sees what it thinks is a correct CSS
comment closing tag. The last line of the hack is a normal CSS comment,
and its closing tag is what lets IE5/Mac begin parsing code again. We
generally refer to these two lines (the top and bottom in the above
code box) as the "Mac-hack," but it is also referred to as a
"comment-backslash hack."

The second, or middle line, has, in this example, three items separated
by descendant combinators, which are the spaces you can see, and then
the height property within curly brackets. First item is a universal
selector or star, * , which selects any element, followed by html
(both also in red), followed by the element suspected to have the bug.
The above code selects an element with the class attribute of buggybox
that is a descendant of an html element, (which will always be
true), when html itself is a descendant of any element (*), and
applies a {height: 1%} to that element, in this case, .buggybox.

It so happens that all IE browsers, both Win and Mac, recognize an
invisible and mysterious wrapper element around <html> . The use of
the universal selector preceding html , also known as the Tan Hack (or
Star HTML Selector Bug), works in IE browsers and nowhere else. Thus,
the reason for using the "Mac-hack" is to prevent IE5/Mac from seeing
this height just as other browsers are, because it does not wrongly
enlarge the box like IE/Win, but it does read the Tan hack.

Note that the element to be given the height need not be classed. Any
valid selector may be inserted instead of .buggybox, and even entire
strings using descendant combinators may be used there. What really
matters is that * html must always precede whatever target element is
to be fixed, and that the * and html have a space between them,
followed by another space, and then the target element. ...."
****************************************
Hope this saves someone the 2 hours it took me to find the solution.
Thanks to the folks who created the Hollyhack, and who wrote google
articles pointing me to it.

Nancy Steinmann
MCSD .NET

Jul 21 '05 #1
0 1447

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: Guadala Harry | last post by:
In an ASCX, I have a Literal control into which I inject a at runtime. litInjectedContent.Text = dataClass.GetHTMLSnippetFromDB(someID); This works great as long as the contains just...
14
by: Joe | last post by:
Hello All: I am trying to dynamically populate a web page with literal content and controls (textboxes and checkboxes (and eventually two buttons - the buttons do not appear in the code yet). I...
6
by: Joe | last post by:
I know that the Literal control will not render a <span> tag so I can not format its text. Other than this, what is the difference betwen the Literal control and the LiteralControl Control? How...
0
by: NancyASAP | last post by:
In case anyone hasn't seen this problem, just sharing the info.... I created a dotnet 1.1 page with a literal control. I used a streamreader to open a text file to fill the control. I filled the...
5
by: George Jordanov Ivanov | last post by:
All, Today I was playing with Literal control. Basically it is more or less like the Label control with this difference that Literal control is something like "lightweight" text container (that...
2
by: Mark A. Sam | last post by:
Hello, I want to use a literal control to provide information about people listed on a webpage, where the control is on the same line as the person it addresses, so that I have a button, the...
5
by: Mark A. Sam | last post by:
Hello, I am trying to use a literal control to past test onto a page from several buttons, so that each button displays something different. The problem I am encountering is that the text wraps...
5
by: paul.hester | last post by:
Hi all, I have a custom control with an overridden Render method. Inside this method I'm rendering each control in its collection using their RenderControl method. However, I'm running into a...
4
by: Neo Geshel | last post by:
Just moved to C# from VB.NET, frustrated to hell and back by inability to get much-copied (from about 20+ different resources) literal example to work. Master Page content: <meta...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.