News for hackers. Stuff that matters.
Re:Write HTML Like It's 1999 by whalesalad on Saturday June 08, 2019 @02:28PM (#20134144)
Instead of a border I tend to have a debug helper that adds a 1px outline of cyan or pink. To get the “bones” of a component or page.

Good advice. Definitely sounds like captain obvious but it’s also something I think needs to be said.

Re:Write HTML Like It's 1999 by trnglina on Saturday June 08, 2019 @02:48PM (#20134248)
And for anyone who isn't familiar with (what I would consider) the most important difference in this use-case: borders affect the positioning of other elements, whereas outlines do not. You don't want to be using a temporary border, since it can significantly affect the layout of your site when you remove it.
Re:Write HTML Like It's 1999 by mdtusz on Saturday June 08, 2019 @03:24PM (#20134504)
* { box-sizing: border-box; }

I have never wanted anything other than this behaviour, so I pretty much always include it when starting on a fresh project.

Re:Write HTML Like It's 1999 by adamwathan on Saturday June 08, 2019 @03:43PM (#20134643)
Borders still affect the positioning of things even with box-sizing set to border-box. For example, here "Block 1" is still two pixels taller than "Block 2":

<div style="padding: 8px; border: 1px solid black"> Block 1 </div>

<div style="padding: 8px;"> Block 2 </div>

https://jsfiddle.net/t4rkvfzx/

Re:Write HTML Like It's 1999 by GrantSolar on Saturday June 08, 2019 @03:55PM (#20134724)
Does that really matter though? A difference of 2px for something temporary doesn't seem like much concern. While I understand the implication is that these can accumulate and cause larger layout issues, the purpose of this practice is to highlight those areas to remove that accumulation anyway
Re:Write HTML Like It's 1999 by ComputerGuru on Sunday June 09, 2019 @12:31AM (#20137129)
The bigger issue is that you don't know if a UI inconsistency is a bug or a side-effect.
Re:Write HTML Like It's 1999 by _bxg1 on Saturday June 08, 2019 @03:59PM (#20134749)
For this case of debugging, though, borders might actually be preferable because outlines would overlap, potentially obscuring the DOM depth
Re:Write HTML Like It's 1999 by Jaruzel on Saturday June 08, 2019 @05:37PM (#20135348)
When I'm coding DIV layouts by hand, I temporarily assign each DIV with a random background-color. Once I have the layout and responsiveness required, I strip the background-color setting on each DIV as I fill them up with content. Works for me.
Re:Write HTML Like It's 1999 by whalesalad on Saturday June 08, 2019 @04:05PM (#20134794)
Yep, that is exactly why I do this! Great explanation.
Re:Write HTML Like It's 1999 by coldsmoke on Saturday June 08, 2019 @04:40PM (#20135022)
Addy Osmani has a "one-line debugger" that gives each element on the page a random colored outline.

    [].forEach.call(document.querySelectorAll("*"),function(a){a.style.outline="1px solid #"+(~~(Math.random()*(1<<24))).toString(16)})
https://gist.github.com/addyosmani/fd3999ea7fce242756b1
Re:Write HTML Like It's 1999 by felixthehat on Saturday June 08, 2019 @03:13PM (#20134433)
Handy bookmarklet

  javascript:(function(){Array.from(document.body.getElementsByTagName('*'), e => e.style.outline = '2px dotted orangered');})();
Re:Write HTML Like It's 1999 by aabbcc1241 on Saturday June 08, 2019 @03:50PM (#20134685)
Why not inject css instead? That would be more effective
Re:Write HTML Like It's 1999 by felixthehat on Saturday June 08, 2019 @08:39PM (#20136189)
how do you mean?
Re:Write HTML Like It's 1999 by Izkata on Sunday June 09, 2019 @10:29AM (#20139424)
Like this: https://stackoverflow.com/questions/15505225/inject-css-styl...

  var node = document.createElement('style');
  node.innerHTML = '* { outline: 2px dotted orangered; };
  document.body.appendChild(node);
Re:Write HTML Like It's 1999 by err4nt on Sunday June 09, 2019 @11:41AM (#20139892)
This should suffice, no need to make a variable, this can all be done at once:

   document.head.appendChild(document.createElement('style')).textContent = '* { outline: 2px dotted orangered'
Re:Write HTML Like It's 1999 by duxup on Saturday June 08, 2019 @02:51PM (#20134277)
That and I tend to have a debug class handy to drop in to highlight a specific elements... where it is... where the hell did it go!?!!?
Re:Write HTML Like It's 1999 by dillonmckay on Saturday June 08, 2019 @02:42PM (#20134220)
I also make the body background pink and the outline a different color.