?? ? ??????? ??? ? ?? ?? ???? ???? ???? ??? ???? ??? ?? ??? ???? ???? ?????. ?? ???? ?? ??? ??? ? ???? ??? ??? ???? ????. useBreakpoints
??? ???? ????! ???? ??? ???? ??? ???? ??? ?? ? ??? ???? ??? ?????.
useBreakpoints
??? ??????
useBreakpoints
??? Material-UI? useTheme
? useMediaQuery
??? ???? ??? ?? React ?????. ?? ?? ??? ????? ???? ??? ????? ???? ?????? ?? ??? ???? ??? ?? ??? ??? ? ????.
? useBreakpoints
? ??????
- ??? ?? ??: ??? ? ???? ???? ?? ?????? ?????? ?? ??? ??? ??? ?? ? ????. ??? ???? ???? ???? ????, ???? ???? ?? ??? ????? ?? ? ????.
-
? ??? ??: CSS ??? ? ?? ??? ??? ?? ? ?? ????.
useBreakpoints
??? ???? ?? ???? ?? ??? ?? ??? ? ???? ??? ? ?? ?? ?? ??? ? ????. - ?? ??? ??: ?? ?? ??? ??? ???? ?????? ???? ??? ??? ??? ?????? ??? ?? ? ????.
-
???? ???: ?????
useBreakpoints
??? ???? ???? ???? ??? ??? ??? ???? ? ??? ? ? ????.
useBreakpoints
??
???
??? React ???????? useBreakpoints
??? ???? ???? ??? ?? ?? ??????.
1??: ?? ??
?? Material-UI? useTheme
? useMediaQuery
? ???? ??? ?? ??? ??? ?? ??? ?????.
import { useMediaQuery, useTheme } from '@mui/material'; /** * 自定義鉤子,根據(jù)主題獲取斷點(diǎn)的當(dāng)前狀態(tài)。 */ export const useBreakpoints = () => { const theme = useTheme(); const isMd = useMediaQuery(theme.breakpoints.only('md')); return { isMd, }; };
2??: ?? ??
?? ?? ???? useBreakpoints
??? ???? ??? ? ???? ????? ??? ????? ?????. ?? ?? Material-UI ?? ??? ???? ??? ???? ??? ???? ???? ???? ??? ? ????.
import React from 'react'; import { useBreakpoints } from '/Users/jack/Work/SGInnovate/frontend/packages/shared/ui/utils/breakpoints'; import { Table, TableBody, TableCell, TableContainer, TableHead, TableRow, List, ListItem, Paper } from '@mui/material'; const ResponsiveComponent = () => { const { isMdDown } = useBreakpoints(); const data = [ { id: 1, name: 'Item 1', value: 'Value 1' }, { id: 2, name: 'Item 2', value: 'Value 2' }, { id: 3, name: 'Item 3', value: 'Value 3' }, ]; return ( <div> {isMdDown ? ( <List> {data.map((item) => ( <ListItem key={item.id}>{item.name}: {item.value}</ListItem> ))} </List> ) : ( <TableContainer component={Paper}> <Table> <TableHead> <TableRow> <TableCell>Name</TableCell> <TableCell>Value</TableCell> </TableRow> </TableHead> <TableBody> {data.map((item) => ( <TableRow key={item.id}> <TableCell>{item.name}</TableCell> <TableCell>{item.value}</TableCell> </TableRow> ))} </TableBody> </Table> </TableContainer> )} </div> ); }; export default ResponsiveComponent;
?????! useBreakpoints
??? ???? ???? ???? ??? ???? ??????? ?? ?? ? ????.
??
useBreakpoints
??? React?? ??? ???? ? ?? ??? ? ?? ??? ?????? ??? ?????. ??? ?? ??? ?? UI? ??? ???? ??? ???? ?? ???? ?? ????? ???? ?? ??? ??? ?? ? ????. ??? ? ??????? ???? ??? ? ???? ???? ? ??? ???? ???? ??? ???? ? ??? ? ? ????. ??? ?? ????? ?? ????? ??? ????? ??? ???!
? ??? useBreakpoints? ???? React? ??? ??? ???? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

CSS?? ????? ??? ? ?? ??? ????. 1. HTML ? CSS? ?? ??? ?????? ???? ?? ???? ?? ???? ??????. 2. ?? ??? ??? ?? ???? ???? ?? ?? ??? ?? ?? ??? ??????. 3. ??? ????? ???? JavaScript? ?? ???? ?????? ??? ?????. ? ?? ??? ??? ??? ????? ?? ??, ??, ??? ? ?? ???? ?? ?? ?? ??? ???? ?????.

CSS ???? ??? ? ??? ??? ????? ???? ??? ???? ???? ?? ?? ???? ????? ???????. 1. Flexbox ? ??? ??? ?? ???? ??? ??, ?? : ??? ?? ? ????? ??? ????. 2. Caniuse ?? ?? ?? ??? ??????. 3. -webkit-, -moz-, -ms-, -o- ? ?? ???? ???? ???? ?????. 4. AutoPrefixer? ???? ???? ???? ???? ?? ????. 5. ?? ????? ????? PostCSS? ???? BrowsersList? ??????. 6. ?? ? ???? ???? ?????. 7. Modernizr ?? ??? ??? ????? ??? ? ????. 8. ?? ????? ???? ?? ? ??? ????.

themaindifferencesbetweendisplay : ???, ??, andinline-blockinhtml/cssarelayoutbehavior, spaceusage ? stylingcontrol.1.inlineElementsFlowWithText, do n'tStartonnewlines, ingorewidth/height, andonlyapplyhorizontalpadding/margins —IdealforIneTeTexting

CSS? ?? ?? ??? ??? ??? ???? ???? SVG? ???? ?? ???, ?? ????, ??? ?? ?? ??? ?? ???? ??????. ??? ??? ????. 1. ?, ??, ??? ?? ?? ??? ?? ??? ?????. 2. ?? ?? ? ??? ???? ??? ? ????. 3. ?????? ?? ?? ?? ?? ????? ???? ?? ??? ?? ? ? ????. 4. ???? ???? ??? ??? ??? ????? ?? ? ??? ????. ???? ???? ?? ?? ?? : ? (50pxatcenter) ? ??? ?? ?? : ??? (50%0%, 100 0%, 0%)? ?? ????. ????

??? ?? ???? ???? ??? ??, ?? ??? ??? ? ? ????? ??? ??? ???? ???? ? ? ?? ? ? ????. 1. CSS ?? : ?? ??? ???? ???? ?? ??; 2. ????? ?? ?? ?? ???? ?? ?? ??? ??? ? ????. 3. ?? ??? ??? ??? ??? ?? ?? ???? ????????. 4. ??? ????? ??? ???? ?? ? ??? ??? ?? ??? ?? ?? ??? ????? ???? ?? ????.

CSS? ???? ?? ? ???? ???? ??? ?? ??? ?? ?? ?? ? ? ????. 1. Max width : 100% ? ?? : Auto? ???? ???? ??? ????? ???? ??? ??? ? ??????. 2. HTML? SRCSET ? ?? ??? ???? ?? ??? ??? ??? ??? ???????????. 3. ?? ?? ? ?? ??? ???? ??? ??? ? ?? ?????? ??????. ? ??? ?? ???? ?? ???? ???? ???? ????????.

CSS ??? ??? ?? ?? ?? ? ?? ? ?? ??? ?? ????. 1.px? ?? ??? ????? ?? ??? ??? ?? ??? ?????. 2.EM? ?? ????, ?? ?? ??? ??? ?? ?? ???? ??, REM? ?? ??? ???? ? ????? ??? ????? ?????. 3.VW/VH? ?? ? ???? ??? ??? ??? ??????? ?? ???? ?????? ???????. 4. ??? ?? ?? ? ??, ?? ?? ?? ? ??? ???? ???? ???????. ???? ??? ???? ??? ? ?? ??? ???? ? ????.

?? ????? CSS ?? ??? ????? ?? ?? ??? ??, ?? ?? ?? ??, Flexbox ? ??? ???? ?? ?? ? ?? CSS ??? ????? ??? ???? ???? ?? ????? ??? ?????. 1. ?? ??? ??? ???? ????. ???? CSSRESET ?? NALLER.CSS? ???? ?? ???? ???? ????. 2. IE? ?? ??? ?? ?? ?? ??? ????. ?? ?? : ?? ? ???? ??? ??? ???? ?? ????. 3. Flexbox ? Grid? Edge Case ?? Old ???? ??? ?????. ? ?? ??? ? AutopRefixer ??; 4. ?? CSS ?? ??? ???? ????. Caniuse? ???? ?? ?????????.
