javascript - React js css class background image not visible -


i have added class in react component.
css file:

.bg{    background: url('../img/bg.jpg');    border: 2px solid black; } 

react render method:

  render() {    return (     <div>       <div classname="bg">        hey       </div>     </div>   ); } 

the browser shows border , loads image image not visible.

the screenshot follows: enter image description here

can tell me doing wrong?

this happening because div.bg not have height specified. because of this, height fits text content exactly.

background images of size have no affect on sizing of parent element. if goal able see entire image, need specify height div.bg matches height of original image.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -