Is float really missing from HtmlTextWriterStyle?
I rarely use
Control.Style.Add(HtmlTextWriterStyle.Whatever, "myval");
to set styles for elements, but occasionally I have to create a dynamic element from code-behind and I'll throw in a style via this method, to test out some styling.
Today, I tried to set
float:left;
and was fairly stunned that it doesn't appear to have a float property. I couldn't find much on Google except for this brief log of the issue: Microsoft Connect Log of Error.
So my question is this: Is it really missing and why?
EDIT
So I followed up with @Thomas Levesque's answer and found that the HtmlTextWriterStyle enumeration was introduced on April 3rd, 2003 in .Net 1.1. This was a time when IE 6 was the latest and greatest that MS had to offer. It is possible that due to their shoddy standards, they were still开发者_StackOverflow社区 relying on table based layouts.
I don't have any proof that this is the truth, but it's my favorite answer so far.
You can still use the other Add
overload :
control.Style.Add("float", "left");
But indeed it's weird that it's not in the HtmlTextWriterStyle
enumeration... probably because Internet Explorer wasn't able to render it correctly at the time this enumeration was created ;)
精彩评论