CSS3 in Clip properties

Source: Internet
Author: User

The clip property is used to set the shape of an element. Used to trim an absolutely positioned element.

When an image is larger than the element containing it, the clip property allows you to specify the visible dimensions of an element so that the element is trimmed and displayed in this element.

Use this attribute to note the following three points:

The 1.clip attribute can only be used for absolutely positioned elements, position:absolute or fixed.

There are three values for the 2.clip attribute: auto Default

Inherit inherits the parent's

A well-defined shape, but now only a square rect ()

  clip: { shape | auto| inherit } ;

< top >, < right >, < bottom >, < left > The four elements in a 3.shape rect () cannot be omitted.

The following is a look at the rect () function of the clip property

clip: rect(<top>, <right>, <bottom>, <left>);

What do the four numbers mean? Look at two pictures to understand.

The simple understanding is: The picture flies high is bottom-top, the width is right-left. Of course, the picture will not be negative.

The clip property is available for most browsers and is a little different.

.my-element {

     position : absolute ;      clip : rect( 10px 350px 170px 0 ); /* IE4 to IE7 */      clip : rect( 10px , 350px , 170px , 0 ); /* IE8+ & other browsers */ }

Write an example below

<!doctype html>

The original image and the page display picture are as follows

Original

(page display)

Reference: http://tympanus.net/codrops/2013/01/16/understanding-the-css-clip-property/

CSS3 in Clip properties

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.