CSS

CSS Overview Selectors Declarations Rule Sets Comments Reset/Normalize Origin Importance Order Specificity Inheritance Cascade Layers Inline Styles Internal Styles External Styles @import Absolute Units Relative Units Dynamic Viewport Angle Units Time Units Frequency Units: Resolution Units Keywords Color Formats Color Functions & Spaces Background Color Background Image Background Repeat Background Position Background Size Background Attachment Background Shorthand Multiple Backgrounds Linear Gradients Radial Gradients Conic Gradients Font Family Font Size Font Weight Font Style Line Height Text Align Text Decoration Text Transform Letter Spacing Word Spacing Text Shadow Text Wrap Variable Fonts Content Box Padding Box Border Box Margin Box Box Sizing Property Margin Padding Border Outline Box Shadow Block Display Inline Display Inline Block Display Static Position Relative Position Absolute Position Fixed Position Sticky Position Top Element Position Right Element Position Bottom Element Position Left Element Position Z Index Flexbox Box Layout Display Flex Flex Direction Flex Wrap Justify Content Align Items Align Content Gap, Row Gap & Column Gap Flex Grow Flex Shrink Flex Basis Flex Shorthand Order Property Align Self Practical Applications CSS Grid Layout Grid Display Grid Template Columns Grid Template Rows Grid Template Areas Justify Items Grid Auto Columns Justify Self Nested Grids Responsive Web Design Min Width Max Width Orientation Logical Operators Pointer Hover Prefers Color Scheme Fluid Images Flexible Typography Viewport Width Advanced CSS Features Defining variables Using variables Scope & Inheritance of CSS Variables Property Value Fallback Practical Applications :Hover :Active :Focus :Focus Visible :Visited :Link :First Child :Last Child :Nth Child :Nth of Type :Empty :Checked :Disabled :Enabled :Valid :Invalid :Required :Has :Not :Is :Where ::Before Pseudo Element ::After Pseudo Element ::First Letter ::First Line ::Selection ::Marker CSS 2D Transformations CSS 3D Transformations Transform Origin Transform Style Backface Visibility Transition Property Transition Duration Transition Timing Function Transition Delay Transition Shorthand Ease Timing Function Linear Timing Function Ease In Timing Function Ease Out Timing Function Ease In Out Timing Function Cubic Bezier Function Animations (@keyframes) Defining @keyframes Animation Name CSS Animation Duration Animation Timing Function CSS Animation Delay CSS Animation Iteration Count Animations Direction CSS Animation Fill Mode CSS Animation Play State CSS Filter Blur CSS Filter Brightness CSS Filter Contrast() CSS Drop Shadow CSS Grayscale CSS Hue Rotate CSS Invert CSS Opacity CSS Saturate CSS Sepia Mix Blend Mode Background Blend Mode Object Fit & Object Position Scroll Snap Type Scroll Snap Align Scroll Padding Scroll Margin Scroll Triggered Animations JS Variables

:Enabled


The :enabled pseudo-class is the opposite of :disabled. It selects form elements that are in their default, interactive state. This is useful for applying styles to active elements, often in contrast to disabled ones.


Example 1: Highlighting Enabled Input Fields

/* This CSS rule targets text inputs that are enabled. */
input[type="text"]:enabled {
  /* The border-color property is set to a solid green line. */
  border: 2px solid #4CAF50;
}

Explanation

This CSS adds a green border to all text input fields that are enabled. This can help guide the user's attention to the fields they need to fill out.


Example 2: Adding a Hover Effect to Enabled Buttons

/* This CSS rule targets an enabled button on hover. */
button:enabled:hover {
  /* The background-color is darkened on hover. */
  background-color: #45a049;
}

Explanation

This code enhances user interaction by changing the background color of an enabled button when the user hovers over it. This provides feedback that the button is clickable.


Example 3: Default Styling for Enabled Textareas

/* This CSS rule targets enabled textarea elements. */
textarea:enabled {
  /* Sets the background color to a light yellow. */
  background-color: #ffffed;
  /* Sets the text color. */
  color: #333;
}

Explanation

This CSS applies a light yellow background to all enabled <textarea> elements. This can be used to create a consistent look and feel for all active text entry areas in a form.


Example 4: Pointer Cursor for Enabled Selects

/* This CSS rule targets enabled select elements. */
select:enabled {
  /* The cursor property is set to a pointer. */
  cursor: pointer;
}

Explanation

This code changes the mouse cursor to a pointer when it is over an enabled <select> dropdown menu. This indicates to the user that the element is interactive.


Example 5: Transition Effect on Enabled Inputs

/* This CSS rule targets enabled text inputs. */
input[type="text"]:enabled {
  /* Defines a transition effect for the border-color property. */
  transition: border-color 0.3s ease-in-out;
}

/* This rule applies a different border color on focus. */
input[type="text"]:enabled:focus {
  border-color: #007bff;
}

Explanation

This example adds a smooth transition effect to the border color of an enabled text input when it gains focus. This provides a polished and professional feel to form interactions.