back

</>CodeWithRahul

More
  • Home
  • Cources
  • Tutorials
  • Tutorials
  • Projects
  • Notes
  • Contact
  • Work With Us
  • HTML
  • CSS
  • JAVASCRIPT
  • CC++
  • PHP
  • PYTHON
  • REACT JS
  • DSA

</>Code With Rahul

Create an account
  • INTRODUCTION
    • Information & History
    • Your first CSS Website
    • How CSS Works?
    • Ways to add CSS
    • CSS Selectors
    • CSS Comments
  • CSS Properties
    • CSS colors
    • CSS backgrounds
    • CSS Borders
    • CSS Image
    • CSS Videos Embedding
    • CSS Fonts
    • CSS Text Styling
    • CSS Padding
    • CSS Margin
    • CSS Hover
    • CSS Links
    • CSS Combinators
    • CSS Pseudo Classes
    • CSS Buttons
    • CSS Overflow
    • CSS Float
    • CSS !Important
    • CSS Maths Function
    • CSS Size
    • CSS Positioning
    • CSS Z-index
    • CSS Forms
    • CSS Navigation
  • CSS Designing
    • CSS Display
    • CSS FlexBox
    • CSS Grid
    • CSS Meida Queries
  • CSS Advance Topics
    • CSS CSS 2D
    • CSS Transform
    • CSS Transition
    • CSS Border Image
    • CSS Gradients
    • CSS Inherit
    • CSS Shadows
    • CSS ToolTip Text
    • CSS Border Image
    • CSS Masking
    • CSS Pagination
    • CSS Meida Queries Advance
    • CSS Animation
  • CSS FAGS
    • CSS Questions

    CSS Hover

    CSS hover is used to enhance the user experience. We can change the appearance or the behaviour of the HTML element(s) when the user hovers over it.

    Syntex

    <style>
        selector:hover {
            /* CSS rules(s) */;
        }
    </style>

    Example 1

    <html lang="en">
    <head>
        <style>
            #p1{
                color: yellow;
            }
            #p1:hover{
                color: red;
            }
            #p2 {
                border: 2px solid red;
            }
            #p2:hover{
                border: 5px solid purple;
            }
        </style>
    </head>
    <body>
        <p id="p1">CodeWithRahul</p>
        <p id="p2">Developers are Founder of rahul3133.github.io/codewithrahul/htmls/index.html</p>
    </body>
    </html>

    Output:

    Owner of this WebPage Image

    CodeWithRahul

    Copyright © 2023 CodeWithRahul.com