mirror of
https://github.com/michivonah/nextjs.git
synced 2025-12-22 22:16:28 +01:00
add hero images
This commit is contained in:
parent
3ba540fb87
commit
aa734325b4
2 changed files with 44 additions and 1 deletions
27
README.md
27
README.md
|
|
@ -129,6 +129,9 @@ When non existing tailwind class matches the value you need, a custom value can
|
|||
| group | defines a parent element for a group |
|
||||
| group-hover:<CLASS> | adds a class on hover over the parent of the group |
|
||||
| dark:<CLASS> | only apply styling in dark mode |
|
||||
| md:<CLASS> | media query for desktop devices |
|
||||
| hidden | display: none; |
|
||||
| block | display: block; |
|
||||
|
||||
Tailwind uses a custom spacing scale. The translation table can be found [here](https://gist.github.com/crswll/5d91b14373f53d66317e407bbba6d3dd).
|
||||
|
||||
|
|
@ -211,6 +214,30 @@ export default function RootLayout({
|
|||
|
||||
The same way other fonts can be imported and also just applied on single objects.
|
||||
|
||||
## Images
|
||||
Next.js comes with a built-in image component, which does many image optimizations like serving images as `webp` or `avif` where possible, automatically.
|
||||
|
||||
The componennt is called `<Image>`.
|
||||
|
||||
Example usage:
|
||||
```tsx
|
||||
import Image from 'next/image';
|
||||
|
||||
export default function Page() {
|
||||
return (
|
||||
<Image
|
||||
src="/hero-desktop.png"
|
||||
width={1000}
|
||||
height={760}
|
||||
className="block"
|
||||
alt="just an example"
|
||||
/>
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
The `width` and `height` should be specified to prevent layout shift - the values set are just used for defining the right aspect ratio - Next.js decides by itself which size has to be rendered.
|
||||
|
||||
## Ressources
|
||||
- [Next.js Installation](https://nextjs.org/docs/app/getting-started/installation)
|
||||
- [Next.js React Foundations Course](https://nextjs.org/learn/react-foundations)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue