Online CSS Editor

How to Increase the Space Between Text and Underlining in CSS

Unfortunately for web designers, CSS does not provide many options for the underlines below texts. You may have difficulty when trying to increase the gap between a text and its underlining.

In this snippet, we’ll show how to do this. Just follow the steps below!

Create HTML

div> span> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. span> div>

Add CSS

div < width: 400px; > span < padding-bottom: 10px; border-bottom: 1px solid #1f67db; line-height: 48px; >

Here you can see the result of our code.

Example of increasing the space between a text and its underlining:

html> html> head> title>Title of the document title> style> div < width: 400px; > span < padding-bottom: 10px; border-bottom: 1px solid #1f67db; line-height: 48px; > style> head> body> div> span>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. span> div> body> html>

Result

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.

In this example, we increased the space between the text and underlining with a border-bottom. You can control the space using line-height and padding-bottom properties.

Example of increasing the space between a text and its underlining using only a :

html> html> head> title>Title of the document. title> style> span < display: inline-block; border-bottom: 1px solid #000; padding-bottom: 10px; > style> head> body> p> span> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. span> p> body> html>

However, you may have difficulty using border-bottom as it may not provide full control over the underlining. To have more pixel accuracy, you can use the :after pseudo-element.

a < text-decoration: none; position: relative; > a:after < content: ''; width: 100%; position: absolute; left: 0; bottom: 1px; border-width: 0 0 1px; border-style: solid; >

You can position the underlining where you want by changing the value of the bottom property.

Читайте также:  Logstash and java logs

Example of increasing the space between a text and its underlining using the ::after pseudo-element:

html> html> head> title>Title of the document. title> style> a < text-decoration: none; position: relative; > a:after < content: ''; width: 100%; position: absolute; left: 0; bottom: 1px; border-width: 0 0 1px; border-style: solid; > style> head> body> a href="https://www.w3docs.com/">W3docs a> p> Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. p> body> html>

It is not possible to increase the space between a text and its underlining if you use the text-decoration property set to “underline”.

Источник

HTML/CSS: Proper Spacing Following Text

To solve the issue of removing space before and after text in an HTML table without adding a Print Document in a new element of the controller, there are several options available. One approach is to add CSS, while another involves using the correct HTML and selecting the checkbox in CSS. Additionally, one can use margin in style, which can be implemented using inline, internal, or external CSS. For a demonstration of these solutions, see the FIDDLE, style.css, and page.html files.

Spacing after text in html/css

The reason for not having creating extra space after the text remains unknown despite adding padding or margin .

Can you please suggest a solution for the problem I’m facing? I added padding and margin to create space after Stay Tuned text, but it’s still not working.

@import url('https://fonts.googleapis.com/css?family=Montserrat'); body < background: transparent; >.title123 < font-family: "Montserrat"; text-align: center; color: #FFF; letter-spacing: 1px; >h23 < background-image: url(https://media.tenor.com/images/ad3dbde6dd7863faeb8151178df7bc71/tenor.gif); color: transparent; -moz-background-clip: text; -webkit-background-clip: text; text-transform: uppercase; font-size: 35px; >/* styling my button */

Padding and margins are only applicable to block-level elements. To ensure that the h23 element can be styled with padding and margins, you must first convert it into a block-level element. This is necessary since h23 is not a known HTML element and will be displayed as an inline element by default.

Читайте также:  Owncloud trusted domains config php

While it is not recommended, you may use it in case you require padding or margins. To do this, you can add either block or inline-block to your CSS, along with a corresponding rule.

The element identified by h23 is not an HTML heading tag. To make it work, replace it with and add a class to target it.

How to insert space after four characters in html input?, I need to insert a space after every four characters while the user is typing a credit card number using JavaScript . <input type=»text» size=»19″ …

Adding white space after input?

Is it possible to add Print Document in a new element of the controller using a simple CSS rule? The issue is that the Print document text always sticks to the checkbox.

The accurate HTML code is represented by .

You can choose the checkbox in CSS by using the following syntax:

One way to accomplish this task is by using the word «fiddle».

You can use margin in style:

How to add Space in Html, Using Html. If we want to add the space in the document using Html tag to show the space before and after the text then we have to follow the steps which are …

Remove space before and after text in html table

My HTML table isn’t behaving as expected. I attempted to apply remove space to the first two rows on the right, but it did not work. I need a solution to this issue. I have included my code below, and I want to ensure that my table has minimal space between its rows.

 

(!DisplayName!)

(!Position!)

M (!Mobile!)

T (!Phone!)

P.O. Box 31279

Naseejco.com

Saudi Arabia, Jeddah, 21497

The outcome is as follows:

enter image description here

  

(!DisplayName!)

(!Position!)

M (!Mobile!)

T (!Phone!)

P.O. Box 31279

Naseejco.com

Saudi Arabia, Jeddah, 21497

Your desire is to eliminate the ‘text-align:center;’ from this location.

Читайте также:  Математические алгоритмы на python

Extra space added after link tag in html email, For some reason email-clients are adding an extra space after a text link. Here’s the code: Extra space added after link tag in html email. Ask Question …

Источник

How to add space (» «) after an element using :after selector in CSS?

The space character (» «) is used to add space between elements in CSS. it used in the content property of a pseudo-selector, such as :after or :before, it creates a blank space that can be used to separate elements or add visual spacing to a web page.

In annexation to using the space character, we can also use other CSS properties such as margin, padding, border, or width to add space between elements. These properties allows to control the amount of space and the position of space between elements.

Adding space (» «) after an element using :after selector in CSS

The :after pseudo-selector is used to add content after the content of an element. This is also useful for adding separators, icons, or other visual enhancements to a web page. To add a space after an element using the :after selector, we need to set the content property to a space character (» «) and the display property to inline.

Here is syntax of how to use the :after selector to add a space after a heading element −

It is important to note that the :after selector only adds content after the element, it doesn’t change the layout of the element or its surrounding elements. It will also not add any space if the element is empty.

Example

    body < text-align:center; background-color:pink; >h3:after < content:" World" >h3.effect:after 

Hello

space added after Hello

Welcome

No space added after Welcome

To add spaces, the :after selector can also be used to add other types of content, such as text, images and list items.

Conclusion

The :after selector is a powerful tool in CSS that used to add content after an element, including spaces. It also be used to enhance the visual appearance of a website, create separators, or add icons and other images. By combining the :after selector with other CSS properties, It creates even more complex and dynamic effects. It is important to keep in mind that the :after selector only adds content after the element, it doesn’t change the layout of the element or its surrounding elements.

Источник

Оцените статью