I'm working with a web page which currently uses <br>
tags for spacing and page layout, and I want to remove all these tags and replace them with an equivalent in CSS to make the page more accessible to screen readers.
As part of this process, I need to replace the break tags that are currently used for spacing with CSS-based padding.
Could someone tell me what the default line break height is so that I can set my padding to equal that height and save a lot of time?
You can't change the height of <br> tag as its not an HTML element, it is just an instruction which enforces a line break. br does not take up any space in the page. There is a way by which you can increase line break between lines, is by putting multiple br tags.
According to the spec, a default value of 8px is expected to be used for the margin.
The <br> tag in HTML document is used to create a line break in a text. It is generally used in poem or address where the division of line is necessary.
Definition and Usage The <br> tag inserts a single line break. The <br> tag is useful for writing addresses or poems. The <br> tag is an empty tag which means that it has no end tag.
A <br>
element represents a line break. The height of a line break is determined by the current line height of the portion of the document the break element is in.
The default line height depends on a number of factors, including the browser you're using and the current font family. You can find the exact computed line height for any given element in Chrome by inspecting the element, switching to the computed style tab, and filtering for the line-height
property. In most browsers, you should be able to approximate this height with a length value of around 1.2em
. For more on em
units, see the section on relative length units from MDN.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With