1

Maybe this is a bug, or my version of VS 2013 is messed or perhaps it's normal... However I think it should be working and I have spend the day trying to make it work and searched Google and here SO all or most of the day. Here is FULL code to paste into a .aspx file and see for yourself....

<%@ Page Language="VB" %>
<!DOCTYPE html>
<script runat="server">
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .ShortContainer{
            text-align:center;
            margin:0 auto;
            -moz-box-sizing: border-box;
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            border:2px solid red;
            max-width:400px;
    }
    </style>
</head>
<body>
        <div class="ShortContainer"><p>Some Text To Look At</p></div>
</body>
</html>

The idea is to have the DIV with the red border float (not really trying to float here) at 400px in the center of the screen and to scale down as the screen becomes smaller. This is a simplified example set to max 400px to easily see where it is. Instead what I am seeing is 100% width in design time.

The code above renders correctly in all browsers tested. However in design view it's a train wreck!

I hope I explained good enough.

Is it just me?

Thank you.

Hatchet
  • 59
  • 7
  • Don't use or trust design view in VS. It's a joke, use the browser. imho – zgood Jul 12 '15 at 03:24
  • look here - http://stackoverflow.com/questions/1867383/css-renders-differently-on-web-server-than-on-development-environment – DeJaVo Jul 12 '15 at 08:19
  • zgood - Not using the design view is not an option, – Hatchet Jul 12 '15 at 15:07
  • DeJaVo - Your link has nothing to do with VS design view incorrectly rendering a div which has a max-width property set to a value shorter than the screens width. Thank you both for stopping in and looking though. I believe this to be a VS 2013 thing. If I set max-width:800px; on a DIV, VS still shows it 100%. Right click on the file and select "view in browser" the DIV renders correctly. I smell a bug. – Hatchet Jul 12 '15 at 15:13
  • Is there anyone that has another html editor that can see if this behavior exist in those as well? In VS, it doesn't matter if you're editing an .aspx or html file, it's the same. @zgood – Hatchet Jul 12 '15 at 17:07
  • This must really have the CSS & VS guys stumped – Hatchet Jul 13 '15 at 13:38
  • Why must you use the design view? Not trying to be a dick I am genuinely curious. I have been building web apps in Visual Studio for 7 years and have never used the design view because of it's inaccuracies. People view the web with web browsers not Visual Studio design view. – zgood Jul 13 '15 at 13:39
  • @zgood - Part 1.Design view offers instant feedback, I can see margins, padding etc.... There are probably thousands of reason I could think of. I haven't really had any issues except this, which I have submitted a bug report to Microsoft for this. Anyways this discussion isn't really leading to a solution to the original question. I wish I knew how it behaved in other design software packages hence my last call out. – Hatchet Jul 13 '15 at 17:28
  • @zgood - Part 2. I'm looking for the brains of the site to pop-in but I guess they have their heads buried in their own projects. What do you do anyways, refresh the browser every-time you wanna see how your work is coming along? Is that even practical? Web development isn't something I do for a living, desktop applications is. I guess design view is all I know at this point. – Hatchet Jul 13 '15 at 17:28
  • Have you ever been exposed to the Web Developer tools that are built into every major browser? I use Chrome a lot and you can check out their dev tools [here](https://developer.chrome.com/devtools). Just right click any page and click "Inspect Element" and you find some very good HTML/CSS/JavaScript debugging tools. Check out [this](http://imgur.com/iRLgfyS) screenshot. You can see the margins and padding (red and green overlays) as you hover over elements. You can also see every CSS style that is being applied. Yes I do refresh the page to see updated content, which I dont think is a big deal – zgood Jul 13 '15 at 17:55
  • I've been programming since 1991, there isn't much I haven't seen. Chrome is good for spying and so I use it a lot for that, not for coding and debugging... I have submitted this as a bug to Microsoft, along with another one I found yesterday. I like working with design time and this is the way to make it better. I hope they will work the fix for both bugs into the 2015 version. – Hatchet Jul 14 '15 at 17:41

0 Answers0