A question about Alibaba's interview, a question about Alibaba's interview

Source: Internet
Author: User

A question about Alibaba's interview, a question about Alibaba's interview

I found this interview question from Alibaba. It was very interesting and I did it.

Use div + css to make the following results:

When you move the cursor over a div with a red color, the size of the div increases by 25%, and the other values remain unchanged. For example:

 

The Code is as follows:

 

<! Doctype html>
<Html lang = "en">
<Head>
<Meta charset = "UTF-8">
<Script type = "text/javascript" src = "js/jquery-1.12.2.js"> </script>
<Script type = "text/javascript">
$ (Function (){
$ ("Div: first"). hover (
Function (){
((This).css ({width: "125px", height: "125px "});
}, Function (){
((This).css ({width: "100px", height: "100px "});
});
});
</Script>
<Style type = "text/css">
Body {
Margin: 0px;
Padding: 0px;
}

# Red {
Box-sizing: border-box;
Background-color: red;
Width: 100px;
Height: 100px;
Position: relative;
Z-index: 11;
}
# Green {
Box-sizing: border-box;
Background-color: green;
Width: 100px;
Height: 100px;
Position: absolute;
Top: 100px;
Z-index: 10;
}
# Gray {
Box-sizing: border-box;
Background-color: gray;
Width: 100px;
Height: 200px;
Position: absolute;
Left: 100px;
Top: 0px;
Z-index: 10;
}

</Style>
</Head>
<Body>
<Div id = "red"> </div>
<Div id = "green"> </div>
<Div id = "gray"> </div>
</Body>
</Html>

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.