What is the problem with "absolute positioning" in Visual Studio.Net, and how is this problem solved by "absolute positioning" CSS?

For many years, Visual Studio .NET has offered "absolute positioning" for ASP.NET, allowing you to drag and drop controls onto the design canvas wherever you want them. However, to use this function has always been advice not . Instead, common wisdom said that you should use the "Flow layout" because if you want to use VS.NET absolute positioning, your screen will not display correctly to users whose screen resolution is different from yours.

However, this is old advice. Some time ago CSS came out with the ability to do "absolute positioning" in a standard way, and most or all browsers caught up with CSS and did CSS positioning correctly (or at least enough).

So, the recommended practice is to position elements using CSS absolute positioning.

Question: What does CSS do right about absolute positioning, what does Visual Studio do wrong? How can absolute CSS positioning be okay even for users with different screen resolutions, while Visual Studio .NET cannot?

UPDATE: . The answers here have cleared me. This is how I summarize it:

  • Gradually, VS.NET moved away from using absolute positioning for everything. This is how VB worked from the beginning (meaning Windows applications before the network existed), and VS.NET was made so that VB.
  • However, using absolute positioning since everything on the web page is a very bad idea. See one of the answers below for some specific examples of why.
  • Since it uses absolute positioning for every control in the web application, the page is such a bad idea, all that advice on using "Flow Layout" came up. It was a way to work with VS.NET without positioning everything.
  • Now that CSS is so mature and widely supported and is the preferred positioning mechanism and appearance, STILL CRAZY will absolutely position everything, and for the same reasons. Most of the goods should be allowed to be "in the flow" themselves. However, for some elements here and there, absolute CSS positioning can feel.
  • The VS.NET engine has always used actual inline CSS styles for absolute positioning.

Great to make it all clearer. Thank.

+2


source to share


2 answers


Absolutely positioning all elements by default - as Visual Studio did - is a terrible way to design a site. It was a bad idea then, and it still exists.

The absolute positioning issue has nothing to do with standards or correct rendering in browsers (IE5 NN4 supports both CSS absolute positioning, which is what Visual Studio.NET used to position elements).

The problem with the Visual Studio approach was that it stripped away all the power and elegance of HTML and CSS for the usability of a drag and drop interface. It was designed to enable developers who did not know HTML or CSS to develop web applications.



Even trivial HTML / CSS changes become a nightmare when all of your elements are absolutely positioned. Some of my specific problems:

  • General movement of the alignment . If you add, remove, or resize an element, you need to manually ensure that all controls are still evenly spaced and that the controls do not overlap. If they did ... you just lost the next five minutes of your life to shuffle the overall setup. Nudging controls into place and making sure everyone line up.
  • Select all and move . If the new company logo was 10px taller than the previous one, you will end up selecting all of your controls and moving them 10px ... but wait .. you somehow managed to miss that control. Another five minutes fine, as you interfere with this on-site control.
  • Dynamic content hell . You've placed a description box right below the heading ... which works most of the time. But now the title is wrapped and overlaid by the @ # $ #% description. God forbid you should actually try any page with a lot of dynamic content.

Absolute positioning of multiple elements isn't bad, but unless you're porting a VB6 application to a web form, there's no reason to absolutely position them.

+2


source


As a general point of web development, absolute positioning is frowned upon. It has rare uses, but not much in good CSS design.

Visual studio acquired this layout using inline css style, but it was still absolute css positioning.

The best way to design your web layout is to start with content mapped to valid HTML elements. Then see how you can improve your layout with CSS by applying the correct cascading rules to those elements. Then add classes to the individual elements, which should be positioned differently from the standard elements.



Finally, to add any whiz bang functionality, you can use Javascript like JQuery to visually enhance the look and feel of standard html controls.

Thus, your site can "gracefully degrade" with less accessible browsers.

+7


source







All Articles