What you want to see on DotNetFunda.com ?
Go to DotNetFunda.com
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 2894 |  Welcome, Guest!   Register  Login
Home > Articles > CSS > How to use Rotating, Skew and Multiple background image in CSS3?

How to use Rotating, Skew and Multiple background image in CSS3?

1 vote(s)
Rating: 5 out of 5
Article posted by Sheonarayan on 4/2/2012 | Views: 5933 | Category: CSS | Level: Intermediate | Points: 250 red flag


In this article we are going to learn how to use Rotating, Skew and Multiple background images in CSS3.

This article is continuation of my previous article How to use Opacity, Scale and box shadow and Zooming in CSS 3?

If you are new to CSS3, please read my first article by clicking on the above link so that you would get familiar with the browser prefixes used in this article code snippets.
  

Rotating Effects

Rotate effect is used to rotate the HTML element. Rotate accepts one parameter ie. Degree.

Get HTML 5 and CSS3 Online Training and 500+ ASP.NET web development Tips & Tricks here.

<style type="text/css">

ul.myGallery li

{

float:left;

list-style:none;

border:1px solid #c0c0c0;

-webkit-transition: -webkit-transform 0.5s ease-in-out;

-moz-transition: -moz-transform 0.5s ease-in-out;

transition: transform 0.5s ease-in-out;

}


ul.myGallery li:hover

{

-webkit-transform: scale(1.5) rotate(-10deg);

-moz-transform: scale(1.5) rotate(-10deg);

transform: scale(1.5) rotate(-10deg);

-webkit-box-shadow: 4px 4px 10px red;

-moz-box-shadow: 4px 4px 10px red;

box-shadow: 4px 4px 10px red;

}

</style>

<ul class="myGallery">

<li>

<img src="images/dotnetlogo.gif" /></li>

<li>

<img src="images/iconnectin.gif" /></li>

<li>

<img src="images/itfunda.gif" /></li>

<li>

<img src="images/myfundalogo.gif" /></li>

</ul>

In the above code snippet, transform css style has scale as well as rotate css property style. As the rotate has degree as -10 so when user mouse over the image, it rotates to -10 degree with scale to 1.5 times its current height and width. I have added Scale effect just to make my effects better, it is not mandatory to add Scale with the rotate. Scale property is covered in my last article.

Specifying the transition property in the first CSS class changes the Scale and Rotates properties considering the transition values.

Output



Skew Effects

Skew is used to skew (horizontally and vertically change the angle of the element) the element to a certain degree. Skew accepts 1st parameter as horizontal angle (x coordinate) and 2nd parameter as vertical angle (y coordinate).

<style type="text/css">

ul.myGallery li

{

float: left;

list-style: none;

border: 1px solid #c0c0c0;

-webkit-transition: -webkit-transform 0.5s ease-in-out;

-moz-transition: -moz-transform 0.5s ease-in-out;

transition: transform 0.5s ease-in-out;

}

ul.myGallery li:hover

{

-webkit-transform: scale(1.5) skew(-10deg, 45deg);

-moz-transform: scale(1.5) skew(-10deg, 45deg);

transform: scale(1.5) skew(-10deg, 45deg);


-webkit-box-shadow: 4px 4px 10px red;

-moz-box-shadow: 4px 4px 10px red;

box-shadow: 4px 4px 10px red;

}

</style>


<ul class="myGallery">

<li>

<img src="images/dotnetlogo.gif" /></li>

<li>

<img src="images/iconnectin.gif" /></li>

<li>

<img src="images/itfunda.gif" /></li>

<li>

<img src="images/myfundalogo.gif" /></li>

</ul>

In the above code snippet, transform has scale as well as skew css style property that scale as well as skew the image on mouse over.

Output

Multiple background Effects of the image

Multiple background images can be implemented separating multiple background properties separated by comma (,). In below code snippet, two background images have been specified separated by comma and to set their position, I have set their position as well separated by comma.

<style type="text/css">

body

{

background-image: url('images/dnfmvp.gif'), url('images/dotnetlogo.gif');

background-position: left, right;

background-repeat: no-repeat;

}

</style>

 

Output

Hope this article was useful. Thanks for reading and hope that you liked this article.

If you liked this article, do subscribe for the RSS feed and share this article with your friends and colleague by clicking on below icons.

To read my series of articles on ASP.NET,  CSS3, HTML5, click here.

If you like this article, subscribe to our RSS Feed. You can also subscribe via email to our Interview Questions, Codes and Forums section.

Page copy protected against web site content infringement by Copyscape
Found interesting? Add this to:



Please Sign In to vote for this post.

About Sheo Narayan

Experience:8 year(s)
Home page:http://www.snarayan.com
Member since:Tuesday, July 08, 2008
Level:HonoraryPlatinum
Status: [Microsoft_MVP] [Administrator]
Biography:Microsoft MVP, Author, Writer, Mentor & architecting applications since year 2001.

Connect me on Facebook | Twitter | LinkedIn | Blog

 Responses
Posted by: Vinay13mar | Posted on: 09 Nov 2012 12:47:11 PM | Points: 25

Very nice article please have look of this and let me know your view.
http://www.dotnetpools.com/Article/ArticleDetiail/?articleId=68&title=Zoom Effect Using Jquery In Asp.Net

>> Write Response - Respond to this post and get points
Related Posts

Here i am going to teach you a very nice and cool css effect. Creating circles with css. Is it that amazing. I have tested it in mozilla firefox and chrome browsers. and it works fine.

External style sheets have many powerful that make them ubiquitous in professional Web sites: It keeps your website design and content separate. It's much easier to reuse your CSS code if you have it in a separate file. Instead of typing the same CSS code on every web page you have, simply have many pages refer to a single CSS file with the "link" tag. You can make drastic changes to your web pages with just a few changes in a single CSS file. It allows a single style sheet to control the rendering of multiple documents. This results in a time-savings for the author, a savings of space for the web server, and less download time for the user. This method can be used in both HTML and XML.

In this article we are going to learn, how to use Opacity, Scale and box shadow and Zooming effects in CSS 3.

You must have came across some .css issues related with the browser behavior. Some of the styles that works in IE doesn't work in FireFox. In that situation you need to write conditional code for both browsers.

In this article we are going to learn, how to use transition, text-shadow and border-radius in CSS3.

More ...
About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 5/21/2013 7:40:10 PM