11

Why is web development such a headache?

I'm writing a responsive wesbite from scratch. All goes perfect, even cross browser.
It all works, adapts to screen size etc. Nice! About to get this code into production.

Me: I'll test the iPhone 5 viewport size before I push the code...

Responsive Developer Tools:

FireFox: nu uh, there's a magic random 1px margin to every element on your page now, which you cannot find in your css or in the computed tab. It's magical.

Me: weird, what if I change the viewport size to the iPhone 6's dimensions?

Issue persists.

Me: hmm, what if I add or substract one fucking pixel from the viewport width or height?

FireFox: What 1px margin? Don't know what you're talking about ... There never was one...

Me: ok, weird (sets viewport size back to the iPhone 5 format for testing)

FireFox: I present to you: the magic random 1px margin.

I'm at a loss. I really am. Been clicking and unclicking almost every responsive part of my css I could find for this page and it just doesn't want to work persistently. And I swear to god that it worked a week ago in that exact viewport size. It's so frustrating.

Comments
  • 3
  • 4
    Are you using any CSS reset to establish a consistent baseline?
  • 2
    @sgorneau I'm using meyerweb.com's reset css template, yes. And I checked, it loads in correctly.
  • 11
    Not actually a headache, it's a skill you need to learn
  • 2
    @theabbie well, I don't see how I can learn anything to resolve this.
    Take the iPhone SE's screen dimensions for example.

    That would be 320x568px. It has the random invisible magic margin issue.

    When I change the dimensions to 319x568px (width - 1px): issue disappears. When I then add the 1px again, the issue stays away. When I reload the page in those dimensions (320x568px) again though, the magic border is there again.

    And no there's no JavaScript messing anything up. It's pure HTML5 and CSS3.

    What is this crap?
  • 9
    @LameCode20 Also, a suggestion, The downvote button is for comments which are actually wrong or spam and not the comments you disagree with. Stop downvoting comments, it breaks the policy.
  • 7
    @theabbie I didn't even downvote your comment. Calm down. Stop accusing people of things, it's not nice.
  • 1
    @LameCode20 oh, I am really sorry then, whoever this is, STOP, looks like another bot has taken over
  • 2
    If you're positive it worked a week ago on a same setup, file a bug.
  • 3
    CSS has no bugs or srupit quirks.
    That's just an part of the great Developer experience!
    It's a feature!
  • 8
    I think your magic pixel started downvoting comments... 🤣😇
  • 2
    Glad i mived from web to native development (or backend only) 10 years ago
  • 3
    Summoning @kiki, CSS goddess apparent.
  • 3
    @junon I think @kiki won’t reply to this lowkey bouba content
  • 2
  • 0
    Thanks for your honesty. My question would be why don't other web devs recognize it as the headache that it is.
  • 0
    #doingiterong - but you’ll just keep learning. That’s the job.
  • 2
    @theabbie so what the "not for me" is supposed to mean?
  • 5
    Gimme your code and I’m gonna find why in like two minutes
  • 4
    @kiki Well, I found it. Apparently one of the custom plugins installed on the workstations here enables "ShowGrid" in FireFox config while this usually is turned of.

    The display got messed up in the "responsive" portion of the developer tools because the grid tried to "squeeze" between the border of my viewport and the content. Turning of that flag fixed the issue.

    Testing on a real iPhone now confirms that indeed, it was a FireFox settings thing. There is no random pixel jump when the page is loaded in.
  • 3
    Always test on actual device!
  • 0
    @dmonkey "not for me" downvote doesn't affect public score, If the score is decreased that means it was downvoted as offensive/spam which is wrong.
  • 2
    @theabbie Oh I didn't know
  • 3
    @devJs Unfortunately, the exponentially growing scope of web browsing capable devices makes it impossible to test all the browser types and HTML renderers.

    The next best thing is a well configured responsive devtool.

    Sadly enough, these aren't always as reliable as you'd want them to be.
  • 0
    The easiest way to deal with it - is just write code that works everywhere / and build things small-screen first - and with the right HTML and CSS ; ) because - it's always doing exactly what you tell it to. It's a computer. Even if you don't know what you did... that's what it will do. So, you'll need to know what you are doing.
  • 4
    @sheriffderek sry but that's simply wrong. Maybe if you write assembler code then the computer does exactly what you tell it. But if you write declarative code then you let the computer decide what exactly it has to do. Especially when you have HTML and CSS which have some free room for interpretation on what your declarations mean and how to deal with them.
  • 5
    @sheriffderek Did you read the thread? It had nothing to do with my code. Orcourse I write small screen first.
  • 0
    @LameCode20 yeah I read it. I guess I mean / don’t use the stupid browser tools. Just resize your screen and use a phone.
  • 0
    @Lensflare “works in my brain” and “on my machine.” Surely / CSS is a ‘strong suggestion’ in its declaration. But it’s always doing what the user-agent tells it to - in combination with what you tell it to / for the most part. If you understand those things - then in 2020 - there are no more gotchas.
  • 2
    @sheriffderek except when there are.

    CSS doesn't have quirks, but the browsers do. And I am unable to test all the browsers engines on all devices / OS'es in the demographic of my employer.

    If you do, you have a great advantage over probably most developers out there.

    Some browser engines in combination with some devices just do have quirks and tend to interpret things in a different way.

    And the 2020 thing is true as long as your employer only targets 2020 browsers, which again, would be an advantage.

    My employer wants me to, for instance, support IE 11.

    You're just wrong when you state there are no more "gotchas".
  • 2
    @LameCode20 kind of wonder why there is any grid stuff in there then. Even using plugins or whatever the case may be just causes additional side effects and unneeded headaches.
  • 0
    @example-user I think the person that used that workstation before me was using canvas for a background animation, and was using the grid as a guide? I have no clue. I never use it and it gave me headache for about 30 minutes so indeed, it's crap and it sucks.
Add Comment