678678
678678
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<!-- Creates a custom hover and focus effect for navigation items, using CSS transformations.
- Use the `::before` pseudo-element at the list item anchor to create a hover effect. Hide it using
`transform: scale(0)`.
- Use the `:hover` and `:focus` pseudo-class selectors to transition the pseudo-element to `transform:
scale(1)` and show its colored background.
- Prevent the pseudo-element from covering the anchor element by using `z-index`.
```html -->
<nav class="hover-nav">
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact</a></li>
</ul>
</nav>
<!-- Hides an element completely (visually and positionally) in the DOM while still allowing it to be
accessible.
- Remove all borders and padding and hide the element's overflow.
- Make the `height` and `width` of the element `1px` and negate them using `margin: -1px`.
- Use `position: absolute` so that the element does not take up space in the DOM.
- **Note:** This technique provides an accessible and layout-friendly alternative to `display: none` (not
readable by screen readers) and `visibility: hidden` (takes up physical space in the DOM).
```html -->
</a>
<!-- Adds a fading gradient to an overflowing element to better indicate there is more content to be
scrolled.
- Use the `::after` pseudo-element to create a `linear-gradient()` that fades from `transparent` to `white`
(top to bottom).
- Use `position: absolute`, `width` and `height` to place and size the pseudo-element in its parent.
- Use `pointer-events: none` to exclude the pseudo-element from mouse events, allowing text behind it
to still be selectable/interactive.
```html -->
<div class="overflow-scroll-gradient">
<div class="overflow-scroll-gradient-scroller">
Lorem ipsum dolor sit amet consectetur adipisicing elit. <br />
</div>
</div>
<!-- -->
- Use `background-size` to specify the pattern's size. Use `background-position` to appropriately place
the two gradients.
- **Note:** The fixed `height` and `width` of the element is for demonstration purposes only.
```html -->
<div class="polka-dot"></div>
<!--
- Use `::-webkit-scrollbar-track` to style the scrollbar track (the background of the scrollbar).
- Use `::-webkit-scrollbar-thumb` to style the scrollbar thumb (the draggable element).
- **Note:** Scrollbar styling doesn't appear to be on any standards track. This technique only works on
WebKit-based browsers.
```html -->
<div class="custom-scrollbar">
<p>
</p>
</div>
- Use `user-select: none` to make the content of the element not selectable.
- **Note:** This is not a secure method to prevent users from copying content.
```html -->
- Use the `content` property and the `attr()` function to display the link URL in the `::before` pseudo-
element.
```html -->
<a href="https://30secondsofcode.org"></a>
Vertically and horizontally centers a child element within its parent element, using `display: table`.
- Use `display: table` to make the `.center` element behave like a `<table>` element.
- Set `height` and `width` to `100%` to make the element fill the available space within its parent
element.
- Use `display: table-cell` on the child element to make it behave like a `<td>` elements.
- Use `text-align: center` and `vertical-align: middle` on the child element to center it horizontally and
vertically.
- The outer parent (`.container`) must have a fixed `width` and `height`.
-->
<div class="container">
</div>
Creates a donut spinner that can be used to indicate the loading of content.
- Use a semi-transparent `border` for the whole element. Exclude one side that will serve as the loading
indicator for the donut.
- Define and use an appropriate animation, using `transform: rotate()` to rotate the element.
<div class="donut"></div>
</body>
</html>