简体   繁体   中英

html background image change to css?

created one Existing project its non responsive web site.Now i need to change Responsive site. i need to change my logo image responsive site? i changed but its not working?'

   <td colspan="2"  style="background-image:url('site_conf/images/det_banner.jpg'); background-repeat:no-repeat; background-position:center;" width="100%" height="100" align="right" >

this code my site logo image how to change this image to full responsive logo?

i have created class file in html like

  <td class="img1">

My css code:

  @media only screen 
  and (min-device-width: 320px) 
  and (max-device-width: 568px)
  {

    .img1{
         background-image:url('site_conf/images/det_banner.jpg');
         background-repeat:no-repeat; 
         background-position:center; 
         width:100%;
         Height:100;
      } 
}

its not working in responsive ? any mistake my code ?

.img1 class is assigned to <td> so background-size property should be added to make the image occupy 100% size of the width.

CSS

.img1 {
    background-image: url('site_conf/images/det_banner.jpg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 100% ;
    width: 100%;
    Height: 100px;
}

Note: As your existing code is in Table structure I am not 100% sure that my solution will work. but you can give it a try. if you can create a fiddle then it will be easy to guide you.

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