-
Hajipur, Bihar, 844101
Hajipur, Bihar, 844101
CSS Basics
CSS Styling Properties
CSS Box Model
CSS Margin
CSS Padding
CSS Borders
CSS Outline
CSS Height/Width
CSS Max-width
CSS Display
CSS Position
CSS Z-index
CSS Overflow
CSS Float
CSS Inline-block
CSS Align
CSS Box Sizing
CSS Text
CSS Fonts
CSS Icons
CSS Text Effects
CSS Web Fonts
CSS Colors
CSS Backgrounds
CSS Color Keywords
CSS Gradients
CSS Shadows
CSS Links
CSS Lists
CSS Tables
CSS Advanced Selectors & Features
CSS Combinators
CSS Pseudo-classes
CSS Pseudo-elements
CSS Attribute Selectors
CSS Specificity
CSS !important
CSS Units
CSS Variables
CSS @property
CSS Math Functions
CSS Media and Image Styling
CSS Image Styling
CSS Image Centering
CSS Image Filters
CSS Image Shapes
CSS object-fit
CSS object-position
CSS Masking
CSS Layout Techniques
CSS Website Layout
CSS Navigation Bar
CSS Dropdowns
CSS Image Gallery
CSS Counters
CSS Pagination
CSS Multiple Columns
CSS User Interface
CSS Flexbox
CSS Grid
CSS Responsive Design (RWD)
A CSS Outline is a line drawn outside the element’s border to make it stand out.
It does not take up space and does not affect the layout.
element {
outline: 2px solid red;
}
2px
→ outline width
solid
→ outline style
red
→ outline color
Feature | Border | Outline |
---|---|---|
Affects Layout | Yes | No |
Can be Rounded | Yes (border-radius ) |
No |
Position | Inside element box | Outside border |
outline-style
: Type of outline
outline-color
: Color of the outline
outline-width
: Thickness of the outline
outline-offset
: Space between border and outline
outline
: Shorthand for width, style, color
button {
outline-style: dotted;
outline-color: green;
outline-width: 3px;
outline-offset: 5px;
}
input {
outline: 2px dashed blue;
}
Moves the outline away from the element border.
div {
outline: 2px solid black;
outline-offset: 10px;
}
Q1. Add a 3px solid black outline to a <div>
.
Q2. Apply a dotted green outline to all <p>
tags.
Q3. Set only the outline color of a button to blue.
Q4. Set a dashed outline of 2px to all input fields.
Q5. Create a rule using shorthand to set a red 4px double outline.
Q6. Add 10px space between the border and outline using outline-offset
.
Q7. Write a class .highlight
that gives a yellow solid outline.
Q8. Apply a groove-style outline to a section element.
Q9. Create a hover effect that adds a 2px solid outline to a card.
Q10. Set outline-width
, outline-style
, and outline-color
individually on a heading.
CSS Basics
CSS Styling Properties
CSS Box Model
CSS Margin
CSS Padding
CSS Borders
CSS Outline
CSS Height/Width
CSS Max-width
CSS Display
CSS Position
CSS Z-index
CSS Overflow
CSS Float
CSS Inline-block
CSS Align
CSS Box Sizing
CSS Text
CSS Fonts
CSS Icons
CSS Text Effects
CSS Web Fonts
CSS Colors
CSS Backgrounds
CSS Color Keywords
CSS Gradients
CSS Shadows
CSS Links
CSS Lists
CSS Tables
CSS Advanced Selectors & Features
CSS Combinators
CSS Pseudo-classes
CSS Pseudo-elements
CSS Attribute Selectors
CSS Specificity
CSS !important
CSS Units
CSS Variables
CSS @property
CSS Math Functions
CSS Media and Image Styling
CSS Image Styling
CSS Image Centering
CSS Image Filters
CSS Image Shapes
CSS object-fit
CSS object-position
CSS Masking
CSS Layout Techniques
CSS Website Layout
CSS Navigation Bar
CSS Dropdowns
CSS Image Gallery
CSS Counters
CSS Pagination
CSS Multiple Columns
CSS User Interface
CSS Flexbox
CSS Grid
CSS Responsive Design (RWD)