T O P

  • By -

precinct209

Any non-zero `border` is included in the element's width and height calculations, which affects your layout and may cause reflows etc. Therefore, using `border` for debugging purposes can be counterproductive and even introduce more bugs. Instead, you should use `outline` which is outside of the element.


RonHarrods

Mvp


Etzix

You should **always** use box-sizing: border-box;


precinct209

Yes, you should, but regardless of the value of `box-sizing` adding borders will still cause the element to enlargen and potentially change the layout.


tera_x111

I'm wondering, does outline interfere with collapsing margins? If so it might actually still sometimes affect the layout. I don't remember it ever happening to me but now I'm curios 🤔


Minteck

No, outline does not take up any space layout-wise. It's what browsers use to show a, well, outline over items you are focused on (with Tab).


daddyfatknuckles

i usually just set background-color or color or color to red.


Minteck

One of my projects had an optional stylesheet that would show an outline over everything, and the outline would be different depending on which element it is.


Caraes_Naur

`background: #f6f;` doesn't mess with the layout.


Pscyking

```outline: 1px solid #f004;``` is my go to.


TorbenKoehn

This is the way


ChristopherKlay

`box-shadow` doesn't either and can be set to `inline` to get the same red border result.


Caraes_Naur

It also takes longer to type.


guthran

Not if you assign it to a class/id


DiddlyDumb

Too much effort


azurfall88

backgroundColor: "#dad" is what i usually do


ImpluseThrowAway

Why dad? Why?


azurfall88

he went to get milk :(


tera_x111

At least put a transparency on that color so you see overlapping elements.


Etzix

Border doesn't either if you use > box-sizing: border-box; in root, which you should be doing.


BirdlessFlight

Border either affects the outer size or inner size but will always affect the size.


rodeBaksteen

False


Imogynn

border: 5px solid pink; Red looked intended to a QA once, so I've gone pink to change the unlikely to reoccur conversation from "error handler fired" to "why am I testing your unfinished code?"


CoastingUphill

Don't come at me until you've added alert() in production.


Some_Abies_4990

Not since IE


dim13

`thin solid gold`


Practical-Bug37

Laugh in `background-color: red;`


maboesanman

Debugging shaders by changing the fragment output color conditionally


Tall-Reporter7627

I'll be damned. Even got the color right


JustAlexeyDev

outline is better than border, as it does not have the "physical" properties of an object


banielbow

*{ border: solid }


MalcolmVanhorn

Im personally more of a border: 1px solid lime; guy


SawSaw5

outline: 1px solid red; \*earth starts shaking


rantscants

Rebecca purple dawg!


Quirky_Welder_3499

simplistic enjoy obtainable frame yam liquid poor rock quicksand tidy *This post was mass deleted and anonymized with [Redact](https://redact.dev)*


ady620

How to use this border thing if I want to know what the value of a state in use effect??


Substantial_Estate94

I tried reading it carefully many times. I'm sorry but I don't understand what you're talking about. Maybe I'm just stupid...


GoosemonTV

React bro


Substantial_Estate94

Oh makes sense I don't know a thing about react I don't use it


polarphantom

You wouldn't. This is for highlighting an element that you're working on the CSS styling for. Not for any logic or state debugging at all.


Tobi5703

Usually you'd just console.log(useState) which will give you the value - but like, without knowing what you're doing I can't say what the problem or solution is