Add text description and css text description on the image for css implementation

Source: Internet
Author: User

Add text description and css text description on the image for css implementation

Add text instructions on the image for css implementation:
In some image effects, there is a text description on the image. The following describes how to achieve this through code examples.
The code example is as follows:

 

<! DOCTYPE html> 

 

The above Code meets our requirements. The image has text instructions and translucent effects. The implementation principle is very simple, that is, to set the outermost div to use relative positioning, and then set the absolute positioning of the span element, so that the external div can be used as the positioning reference object, set the top attribute value. But the above is not perfect, because not only the background is transparent, but also the text is transparent. This is often not what we want to see. The Code is as follows:

<! DOCTYPE html> 

The above Code meets our requirements. The background is transparent but the text is not transparent. In the above Code, the reason why the text is transparent is that the transparent property has inheritance, and the sub-element will also have a transparent effect, in this way, you can use the positioning method to overwrite the span element of the text and overwrite the translucent span element.

The original address is: http://www.softwhy.com/forum.php? Mod = viewthread & tid = 12679.

For more information, see: http://www.softwhy.com/divcss/

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.