Another CSS picture replacement trick

Source: Internet
Author: User

The -9999 px Image substitution technology has been popular for one of the best parts of the decade. Replace a text element and an image, you can use the following code:

<style>
H1
{
Background:url ("MyImage") 0 0 no-repeat;
Text-indent: -9999px;
}
</style>
The background of the element is displayed and its text is moved away from the screen so that it does not interfere. Simple and effective. It is often used to display graphic titles-it is rarely necessary now that we have webfonts, but you will still feel it using the Web.

Until now.

A new technology has been found:
{
text-indent:100%;
White-space:nowrap;
Overflow:hidden;
}
The code indents the text beyond the width of its container, but it does not wrap and overflow is hidden.

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.