简体   繁体   中英

background image not showing in div

I am not able to have a background image show in a div. See this fiddle . Can someone show me where I am going wrong please? This seems like a simple thing to do.

You simply need a height for the div if you wish to see it.

Divs automatically have 100% width and 0 height.

See what happens when you add height.

Your div is empty. Put some text in it, and the background image will appear.

Alternatively, give your div a height.

Add height:32px; and width:32px; to show one arrow ( JSFiddle ). The height of a div is determined by its content, so if you want to render the background of a container either specify its height or fill it with content.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM