Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • jQuery
  • AngularJS
  • ReactJS
  • Next.js
  • React Native
  • NodeJS
  • Express.js
  • MongoDB
  • MERN Stack
  • PHP
  • WordPress
  • Bootstrap
  • Tailwind
  • CSS Frameworks
  • JS Frameworks
  • Web Development
Open In App
Next Article:
How to Create Animated Navigation Bar with Hover Effect using HTML and CSS ?
Next article icon

How to create Skewed Background with hover effect using HTML and CSS?

Last Updated : 29 Jul, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

The skewed background or you can say an angel color shade background can be created by using HTML and CSS. This background can be used as a cover pic of your website that will be attractive. In this article, we will create a simple skewed background. We will divide the article into two sections in the first section we will create the structure and in the second section, we decorate the structure.

https://media.geeksforgeeks.org/wp-content/uploads/20240726133517/gfg.mp4

Creating structure:

In this section, we will create the structure by using only simple HTML codes.

HTML Code: By using the HTML <section> tag we will create the section for our skewed background which will have a HTML <div> tag inside of it. HTML

<!DOCTYPE html> <html>  <head>     <meta>     <title>         Skewed Background using HTML and CSS     </title> </head>  <body>     <section>         <div class="content">             <h2>GeeksforGeeks</h2>         </div>     </section>  </body>  </html>                     

Designing structure:

In this section we will decorate the pre-created structure with the help of CSS.

CSS Code: In this section first we will use some CSS properties to design the background and then we will use the skew property of the CSS which skews an element along the x and Y axis by the given angles. CSS

<style>     body {         margin: 0;         padding: 0;         font-family: serif;     }          section:hover {           background: linear-gradient( green , yellow);     }          section {         display: flex;         background: green;         height: 350px;         justify-content: center;         align-items: center;         transform: skew(0deg, -10deg) translateY(-120px);     }          .content {         margin: 0;         padding: 0;         position: relative;         max-width: 900px;         transform: skew(0deg, 10deg);         text-align: center;     }          .content h2 {         color: #fff;         font-size: 80px;     } </style> 

Final Code:

It is the combination of the above two code sections by combining the above two sections we can achieve the skewed background.

Program: HTML

<!DOCTYPE html> <html>  <head>     <meta>     <title>         Skewed Background using HTML and CSS     </title> </head> <style>     body {         margin: 0;         padding: 0;         font-family: serif;     }          section:hover {           background-image: linear-gradient(to left, green , yellow);           transition-time: 5s;     }     section {         display: flex;         background: green;         height: 350px;         justify-content: center;         align-items: center;         transform: skew(0deg, -10deg) translateY(-120px);     }          .content {         margin: 0;         padding: 0;         position: relative;         max-width: 900px;         transform: skew(0deg, 10deg);         text-align: center;     }          .content h2 {         color: #fff;         font-size: 80px;     } </style>  <body>     <section>         <div class="content">             <h2>GeeksforGeeks</h2>         </div>     </section>  </body>  </html>    

Output:

https://media.geeksforgeeks.org/wp-content/uploads/20240726133517/gfg.mp4


Next Article
How to Create Animated Navigation Bar with Hover Effect using HTML and CSS ?

L

lakshgoel204
Improve
Article Tags :
  • Web Technologies
  • Web Templates

Similar Reads

  • How to Create a Wave Image for a Background using HTML and CSS ?
    This type of background creates uniqueness on your webpage by avoiding regular rectangular sized background or header. The following header design will show your creativity. This design can be achieved in two ways: Using ::before and ::after selector on a div element in CSS.Using SVG in HTML. Exampl
    3 min read
  • How to create a skewed background using CSS ?
    A skewed background design enhances a website's visual appeal with dynamic, angled elements. By using CSS transform: skew() along with ::before and ::after pseudo-elements, you can easily create a slanted effect, adding a modern and engaging look to your site's layout. ApproachHTML Structure - Secti
    2 min read
  • How to Create Animated Navigation Bar with Hover Effect using HTML and CSS ?
    The Navigation bar or navbar or menu-bar is the most important component of any web or mobile application. The user can only navigate from one page to another page through this menu. It is usually provided at the top of the website to provide a better UX (user experience). Approach: The approach is
    3 min read
  • How to Create a Sliding Background Effect Using CSS ?
    A sliding background effect in CSS creates a smooth, continuous movement of a webpage’s background image, typically in a horizontal or vertical direction. It gives a dynamic, animated feel by using properties like background-position and animation, enhancing visual engagement without additional Java
    1 min read
  • How to create paper corner fold effect on hover by using HTML and CSS?
    The folding effect is quite attractive on the website, may you have seen on some websites when you hover on the paging layout it gets folded on the corner. The folding corner effect can be achieved by using HTML and CSS only. The below sections will guide you on how to create the animation. In this
    3 min read
  • How to Create Text Reveal Effect for Buttons using HTML and CSS ?
    Buttons are the most important user interface component for any website. It is very important to design the buttons in a creatively unique way. The text-reveal effect for a button is used when it is used to reveal some offer or exciting content for enhancing the user experience. Approach: The approa
    2 min read
  • How to Create Floating Box Effect using HTML and CSS ?
    The floating box effect is a classical example of a custom box-shadow technique. In this technique, we create realistic-looking shadows without using the box-shadow property that is provided by the CSS. Approach: The approach is to use after selector to use create shadow using the blur function. HTM
    2 min read
  • How to create a Spotlight Effect using HTML and CSS ?
    In this article, we are going to create a spotlight effect over the image when we hover over it. This is mainly based on HTML, CSS and JavaScript. The below steps have to be followed to create this effect. HTML Section: In this section, we will create a container elements for the background image an
    4 min read
  • Responsive Card with hover effect using HTML and CSS
    Cards are very important part for any website. It is used to display some important information in short to viewers. So, in this article, we will create a  responsive card with amazing hover effect using HTML and CSS. By using HTML we will design the basic structure of the card and then by using the
    4 min read
  • How to create Glowing Star effect using HTML and CSS?
    The glowing star effect is one of the coolest effects that is used for dark themed websites. It is known as star effect because it has small glowing balls animated in different ways which looks like stars. This effect can be used for image slider, loader, and maybe as an showcase UI element. Approac
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences