Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a border around all elements in the body of a webpage?

Tags:

html

css

There is some weird white space showing up on the right side of my website in mobile. I was wondering if there is a CSS trick to add a border to all the html elements within the body of a webpage so that I can figure out which element is extending out and causing the white space on mobile.

Thank you

like image 228
Alex Douglas Avatar asked Oct 05 '14 20:10

Alex Douglas


People also ask

How do I add a border to all elements in HTML?

Borders can be applied to most HTML elements within the body. To make a border around an element, all you need is border-style . The values can be solid , dotted , dashed , double , groove , ridge , inset and outset .

How do you add a border to all elements in CSS?

Include that CSS snippet before your CSS files so that it can be overwritten - or after, to force it onto every element. every element will get a bloody border and that borders will be accounted to the elements widths. box-sizing: border-box; would help to temporarily prevent a total mess.

What property is used to add border to all sides of an element in a web page?

The border-style shorthand CSS property sets the line style for all four sides of an element's border.

How do you add a border to an element?

Similar to the border-width and border-style, we can change the color of the border individually, i.e., we can change the color of the bottom, top, left, and right side of the border of an element. It can be done by using the properties border-bottom-color, border-top-color, border-right-color, and border-left-color.


1 Answers

You can try this CSS snippet:

* { border: 1px solid black; }

Every element should now get a border. Beware, this means everything. Hopefuly it'll help you figure out that white space in your app!

Include that CSS snippet before your CSS files so that it can be overwritten - or after, to force it onto every element.

like image 165
Ingwie Phoenix Avatar answered Oct 23 '22 14:10

Ingwie Phoenix