Absolute Positioning of Controls in VS 2008: Forget It Exists!

Posted on September 21, 2007  |  

Posted in Design


Mikhail Arkhipov has recently posted a tip how to drag a control in VS 2008 and have it absolutely positioned on a web page. Here’s my advice: forget this feature exists! Here’s why.

There existed a hideous MS_POSITIONING attribute some time ago which allowed the VS 2003 designer to drag and drop server controls on a page and position them via the position: absolute CSS rule. My suggestion then was, and still is, to avoid this practice. Don’t get sweet-talked into designing WebForms the same way as WinForms. They differ in just about everything: state, execution environment, interactivity, control over layout, threading, etc.

Another important point here is: form follows function. Dragging server controls and dropping them in arbitrary spots is backward thinking.

Consider page structure first. Put building blocks where they are supposed to be. Endow them with function. The CSS Zen Garden is exactly that: one page with intended structure, first; various presentations, second.

A lot of articles and books have been written on this subject including several sections in Andy Clarke’s Transcending CSS.


Josh Stodola
on September 21, 2007

Couldn't agree with you anymore with your comment about "backward thinking", and I've been telling people the same thing. In fact, I would never use the designer to layout page, period.


on September 23, 2007

[Josh Stodola]
> never use the designer to layout page

What designer are we talking about? A human designer or the Visual Studio "designer?"

Milan Negovan
on September 24, 2007

Yes, I believe Josh was talking about the Visual Studio designer. I never use it either.

Kent Boogaart
on September 25, 2007

Agreed. To me, designer tools are useful as a preview mechanism only (and most aren't even very good at that). This is true back when I did ASP.NET but also now when doing WPF (although for slightly different reasons).

Winforms is an exception. When the winforms designer actually works (rare) I will use it simply because the alternative is writing a heap of mundane code.

As for human designers, I would *love* to have a good graphic and UI designer working with me on *any* project. However, it has been my experience that corporations just don't see the need / won't foot the bill for them. It's like getting a mechanic to paint your car.

on October 5, 2007

Oh stop it..that is the way of old...It's a new Gen of development now which for the most part works just about everywhere. Absolute position is no harmful today as when all the other new technologies emerged.

Use it, love, embrace it.

New Dawn.


Milan Negovan
on October 5, 2007

This feature in no way encourages proper usage of absolute positioning so I expect a lot of people will mindlessly drag stuff around the screen. This is a wrong approach, which was my point up there.

Dean Hiller
on May 20, 2008

As with everything, there is a balance. Right now, I have a client who wants cheap, and sometimes dragging everything over the place just gets the job done. the client is aware that this may require rework later but they don't care...I end up spending less time on the job and charging less for it then. They want it faster and cheaper. That is business 101...make the customer happy, not design the perfect system. So as far as arguing vs. pure clean div's all over or just one big sheet of paper where everything absolutely positioned, the answer is (as it almost always is) "it depends". Context is everything. I myself love pure divs and love being able to redo my design without touching my html. In practice though, there are not many designers in China who can do that which I can't STAND by the way. Even in the US, I have trouble finding those good ones and usually they are really expensive since they are so rare. I do have one rare designer in China that has this skill for 30USD/ hour which is more expensive than I even charge for my developers(OUCH!!!). I had her do my website though with all divs(http://xsoftware.biz)

Dean Hiller
on May 20, 2008

I forgot to mention, when I do use absolute positioning, I still group things in absolute positioned divs so a graphic designer can style it later without touching the html(except they have to add the id or class attributes to the divs of course). Works wonders for speed when you need it.

Sebastian Mueller
on July 2, 2008

For content management and internet the absolute position feature is not worth to mention, but we are also developing industry web solutions, where we create pages that show a part of an industry factory. Here we need absolute position for elements. And we need alignment functionality for multiple elements that also lacks in VS 2008. We know it is proprietary, but for this intranet solution its the best way to do it.

on August 19, 2008

This is the biggest pile of bullshit I have ever heard! There are two types of people in this world: programmers and those who really get work done. In 45 years as a programmer, every programmer I have ever worked with truly believes this;"programming is a rarified art that is only understood by a select few of us. Until you get to be as smart as we are, just shut your mouth and open your wallet to buy us more programming toys and just do what we tell you. When the programmers Hall of Fame is created I will be the first inductee!!!!" Putting together forms that make no sense to anyone but a stupid programmer is hat a programmer is hired to do! "Those who really get work done" want forms that make sense from a business perspective - to hell with what programmers want!

Grant Anderson
on September 16, 2008

I partially agree with the append by domsysrs. I note that seemingly in every profession the majority of people tend (or pursue) complexity either as a subconscious infatuation with it and/or because it increases their job security through guru-hood. The complexity level in programming nowadays, especially web programming, is very (too) high. Referring to a previous append where they had to bring in a designer to get the site looking right...Isn't this a little extreme (and absurb) that this is a COMMON need/requirement? Weren't computers (and software) supposed to make things simpler? Why is software (and now the law, taxes, etc) so excessively complex? Why can't one with just basic knowledge build a web database app in a couple of hours without having to munge code?

on December 8, 2008

Ouch! domsysrs indeed is partially right, although being a programmer myself I think Grant's comment sounds a little less aggressive....

However (hey, I told you I'm a programmer, so there has to be a 'however'!): There ARE tools out there one can use to build a database driven web app without writing a single line of code, but us stupid programmers as well as many (but not all) "people who want to get the work done" don't want just the cheapest solution for their deadline, but also a result that's flexible, reusable, maintainable, identifiable with the company and what else.

What almost every 'boss' wants is to drive a sophisticated, highly personalized car (within their budget of course) and as a mechanic I'd rather have a designer to do the non-technical work. If a man with the positive attitude ("get the work done") really wants just the transport and nothing more perhaps he'd better not hire me but travel by bus.

on April 21, 2009

Just because the author spent $40K of his/her own money on CSS tutorials and schooling and insists on coding every single html tag by hand with vi because that's how he/she was trained is no reason to spread this pain to the rest of us. Absolute positioning is the holy grail of web development. You can detect browser type and redirect to alt. sites for mobile devices if need be.

Kenneth Moss
on March 9, 2010

I've used pure absolute positioning in vs.net 2005 for a 300+ page website for the IRS. I've had others for DoD branches and many commercial companies. For a front end website that must work with multiple browsers, I agree absolute positioning is a bad choice. For backend web portals, it's the only logical choice if you care about a budget.

When you are faced with 3 months to churn out an enteprise site on a contract, believe me, all the rules fly out the door and you get the work done. Absolute positioning has become my saving grace for the web portals.

I find that many web developers rely on CSS and other web methodolgies to get the work done, which is fine. Understand that many of us come from an OOP background. I feel the OOP background is much more indepth that you'll ever get with CSS. I make my web portals using inheritance all over the place. When I need to change something globally, I do it in a base class. It is much more powerful than CSS in my opinion and I prefer my coders I hire to know OOP over web design. Layout and design is something I can hire a graphic artist for.

With web portals, it goes way beyond laying out some tags on a page. It's an enterprise application that must perform. The opinions I get that are against absolute positioning are usually people who are nowhere near the level enterprise architects operate on. You are quick to offer absolutes on what should be used based on your narrow view of the field.

As another post said, it depends.

I would advise anyone who likes the absolute positioning to consider a ClickOnce windows application. I've moved to these for all internal applications (which has clients spread all over the US). I've had nothing but good things come from this. After 2 years of use in the field, it beats the pants off of a web portal and is much more secure. Getting the windows app out the door has been much faster. Clickonce allows a central deployment to a web server where updates are downloaded automatically on client startup.

I do agree with domsysrs also, although it's a bit harsh on how you worded it. There is a different perspective when you move from a developer to an owner who hires developers. The mindset shifts from a yearning to make it perfect to making what the customer wants/needs and only what they asked for. It's funny how money changes the way you look at things.

Ken Moss
CEO Monkeke Inc.

Milan Negovan
on March 22, 2010

Ken, that is a great comment! I appreciate you addressing both sides there.

on April 10, 2010

Yo, I absolutely don't agree with this post... Absolute positioning is something really useful... Helps to position controls in manners you would really want it to be without really checking every time if the coordinates are correct and they are really what you want. So, Absolute positioning rocks.. Don't come and that the designer view isn't a good thing cause it is. instead of writing to much codes where errors can input... oh no not me.... the designer is here to eliminate those errors...

So come on, its not a bad thing to have this designer view and the absolute positioning...