Can you overlay a transparent div on an image

前端 未结 4 784
眼角桃花
眼角桃花 2020-12-23 09:26

I ran accross this example in the image below that is done in Flash and I was wondering if a similar affect of having a transparent box at the bottom of an image with text o

4条回答
  •  时光说笑
    2020-12-23 10:04

    Sure, here is a cross-browser way of doing so:

    
      
        
      
        
          
    Something
    Label Goes Here

    This method doesn't require JavaScript, doesn't cause to lose ClearType text in IE, and is compatible with Firefox, Safari, Opera, IE6,7,8... Unfortunately, it only works for one line of text. If you want multiple lines, either adjust div.imageSub div's height and line-height property, or use the following (modifications to the CSS and requires the label to be specified twice).

    
      
        
      
        
          
    Something
    Label Goes Here
    Label Goes Here

提交回复
热议问题