Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Span with background image and no content

Tags:

I have a span that has no content, but i need a background image (an arrow, by the way).

The problem is without no content inside span the background doesnt appear.

How can i solve this?

like image 953
ulima69 Avatar asked Dec 28 '10 22:12

ulima69


People also ask

Can I put background image for span?

Let's add a background image to the text span — this image will appear within the text: Open Style panel > Backgrounds. Click the Image and gradient "plus" icon. Click Choose Image to select the image for your text fill.

Can a span be an image?

Usually span element is used to group inline elements together to implement style (using id or class attributes) or language information or JavaScript DOM(using id or class attributes), when no other element is found suitable to form that group. 3. The element can contain a piece of text or an image directly.

How do I put a background image in HTML without repeating it?

To make a background image not repeat in HTML, specify no-repeat in the background-repeat property or the background shorthand property. The background image is set to 'no-repeat' using the 'background-repeat' property. The above example uses the background-repeat property to set the image to no-repeat .


1 Answers

Set the width; and height properties of the span.

<span style="width: 90px; height: 90px; background-image: url('bg.jpg'); display:block" /> 
like image 134
WebMonster Avatar answered Sep 24 '22 12:09

WebMonster