Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is Float really missing from HtmlTextWriterStyle?

Tags:

.net

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 relying on table based layouts.

I don't have any proof that this is the truth, but it's my favorite answer so far.

like image 327
Michael La Voie Avatar asked Oct 12 '09 23:10

Michael La Voie


1 Answers

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 ;)

like image 76
Thomas Levesque Avatar answered Nov 11 '22 17:11

Thomas Levesque