title |
---|
CSS ã«é¢ãã質å |
Front-end Job Interview Questions - CSS Questions ã®åçéã§ããææ¡ãèšæ£ã®ãã«ãªã¯ãšã¹ãã¯å€§æè¿ã§ãïŒ
- CSS ã»ã¬ã¯ã¿ãŒã®è©³çŽ°åºŠãšã¯äœã§ããïŒã©ã®ããã«ã¯ããããŸããïŒ
- "ãªã»ãã" ãš "ããŒãã©ã€ãº" CSS ã®éãã¯äœã§ããïŒããªãã¯ã©ã¡ãã䜿ããŸããïŒãããŠããã¯ãªãã§ããïŒ
float
ãšã¯äœã§ããïŒã©ã®ããã«ã¯ããããŸããïŒz-index
ãšã¯äœããšãã¹ã¿ãã¯ã³ã³ããã¹ã(ã¹ã¿ãã¯æè)ãã©ã®ããã«äœãããã®ããæããŠãã ããã- ãããã¯æŽåœ¢æèïŒBlock Formatting Context: BFCïŒãšãã®ä»çµã¿ãæããŠãã ããã
- clear ãè¡ãææ³ã«ã¯ã©ã®ãããªãã®ããããããããã©ã®ãããªç¶æ³ã«é©ããŠããŸããïŒ
- CSS ã¹ãã©ã€ããšã¯äœã§ããïŒããŒãžããµã€ãã«å®è£ ããæ¹æ³ãåãããŠèª¬æããŠãã ããã
- ãã©ãŠã¶åºæã®ã¹ã¿ã€ãªã³ã°ã«é¢ããåé¡ã解決ããã«ã¯ã©ãããã°ããã§ããïŒ
- æ©èœã®å°ãªããã©ãŠã¶ã«å¯ŸããŠã¯ãã©ã®ããã«ããŒãžãæäŸããŸããïŒã©ã®ãããªãã¯ããã¯/ããã»ã¹ã䜿çšããŸããïŒ
- ã³ã³ãã³ããèŠèŠçã«é ãïŒã¹ã¯ãªãŒã³ãªãŒããŒã®ã¿å©çšå¯èœã«ããïŒæ¹æ³ã«ã¯ã©ã®ãããªãã®ããããŸããïŒããã€ãæããŠãã ããã
- ã°ãªããã·ã¹ãã ã䜿çšããããšããããŸããïŒäœ¿ã£ãããšããããªããããªãã¯ã©ã®ã°ãªããã·ã¹ãã ã奜ãã§ããïŒ
- ã¡ãã£ã¢ã¯ãšãªãã¢ãã€ã«åºæã®ã¬ã€ã¢ãŠã/CSS ã䜿çšãããå®è£ ããããšã¯ãããŸããïŒ
- SVG ã®ã¹ã¿ã€ãªã³ã°ã«ã€ããŠã¯è©³ããã§ããïŒ
screen
以å€ã®@media
ããããã£ã®äŸãæããããŸããïŒ- å¹çç㪠CSS ãæžãã«ããã«é¿ããã¹ã "èœãšãç©Ž" ã«ã¯ã©ããªãã®ããããŸããïŒ
- CSS ããªããã»ããµã䜿çšããã¡ãªãããšãã¡ãªãããæããŠãã ããã
- 䜿çšããããšã®ãã CSS ããªããã»ããµã«ã€ããŠå¥œããªãã®ãšå«ããªãã®ãæããŠãã ããã
- éæšæºãã©ã³ãã䜿çšãã Web ãµã€ããå®è£ ããã«ã¯ã©ã®ããã«ããŸããïŒ
- CSS ã»ã¬ã¯ã¿ã«ãããããèŠçŽ ãã©ããªã®ãããã©ãŠã¶ãã©ã®ããã«æ±ºå®ããŠãããã説æããŠãã ããã
- ç䌌èŠçŽ ã«ã€ããŠèª¬æãããããããªãã®ããã«äœ¿ãããŠãããã詳ãã話ããŠãã ããã
- ããã¯ã¹ã¢ãã«ããªãã§ãããã®ããªãã®ç解ãšãããã¯ã¹ã¢ãã«ã§ã¬ã€ã¢ãŠããã¬ã³ããªã³ã°ããããã« CSS ã§ãã©ãŠã¶ã«æ瀺ããè€æ°ã®æ¹æ³ã説æããŠãã ããã
* { box-sizing: border-box; }
ã«ãã£ãŠäœãèµ·ããŸããïŒãã®å©ç¹ã¯äœã§ããïŒ- CSS ã®
display
ããããã£ãšã¯äœã§ããïŒãã®äœ¿ãæ¹ã®äŸãããã€ãæããããšãã§ããŸããïŒ inline
ãšinline-block
ã®éãã¯äœã§ããïŒposition
ãrelative
ãfixed
ãabsolute
ãstatic
ã®èŠçŽ ã®éãã¯äœã§ããïŒ- ããŒã«ã«ãæ¬çªç°å¢ã§ãã©ã®æ¢åã® CSS ãã¬ãŒã ã¯ãŒã¯ã䜿çšããŠããŸããïŒãŸããã©ã®ããã«å€æŽ/æ¹åããŠããŸããïŒ
- CSS ã® Flexbox ã Grid ã®ä»æ§ã§éãã ããšã¯ãããŸããïŒ
- ãŠã§ããµã€ããã¬ã¹ãã³ã·ãã§ã³ãŒãã£ã³ã°ããããšãšã¢ãã€ã«ãã¡ãŒã¹ãã§ã³ãŒãã£ã³ã°ããããšã®éãã説æã§ããŸããïŒ
- ã¬ã¹ãã³ã·ããã¶ã€ã³ã¯ã¢ãããã£ããã¶ã€ã³ãšäœãéããŸããïŒ
- Retina 察å¿ãè¡ã£ãããšã¯ãããŸããïŒãããããªãããã€ã©ã®ãããªãã¯ããã¯ã䜿ããŸãããïŒ
position: absolute
ã®ä»£ããã«translate()
ã䜿çšããã¹ãå Žåã¯ãããŸããïŒãã®éã®å ŽåããããŸããïŒçç±ãåãããŠæããŠãã ããã
CSS ã»ã¬ã¯ã¿ãŒã®è©³çŽ°åºŠãšã¯äœã§ããïŒããã¯ã©ã®ããã«ã¯ããããŸããïŒ
ãã©ãŠã¶ã¯ CSS ã«ãŒã«ã®è©³çŽ°åºŠã«å¿ããŠèŠçŽ ã«è¡šç€ºããã¹ã¿ã€ã«ã決å®ããŸãããã©ãŠã¶ã¯ç¹å®ã®èŠçŽ ã«äžèŽããã«ãŒã«ããã§ã«æ±ºå®ããŠãããšä»®å®ããŸãããããã³ã°ã«ãŒã«ã®äžã§ã詳现床ã¯ä»¥äžã«åºã¥ããŠã«ãŒã«ããšã« 4 ã€ã®ã«ã³ãåºåãå€ a, b, c, d
ãèšç®ãããŸãã
a
ã¯ãã€ã³ã©ã€ã³ã¹ã¿ã€ã«ã䜿çšãããŠãããã©ããã§ããããããã£ã®å®£èšãèŠçŽ ã®ã€ã³ã©ã€ã³ã¹ã¿ã€ã«ã®å Žåãa
㯠1ãããã§ãªãå Žå㯠0 ã«ãªããŸããb
㯠ID ã»ã¬ã¯ã¿ã®æ°ã§ããc
ã¯ã¯ã©ã¹ãå±æ§ãæ¬äŒŒã¯ã©ã¹ã»ã¬ã¯ã¿ã®æ°ã§ããd
ã¯ã¿ã°ããã³æ¬äŒŒèŠçŽ ã»ã¬ã¯ã¿ã®æ°ã§ãã
åŸããã詳现床ã¯ã¹ã³ã¢ã§ã¯ãªããåããšã«å€ãæ¯èŒã§ããè¡åã§ããã»ã¬ã¯ã¿ãŒãæ¯èŒããŠè©³çŽ°åºŠãæãé«ããã®ãå€æãããšãã¯ãå·Šããå³ã«åãã£ãŠèŠãŠãååã®æé«å€ãæ¯èŒããŠãã ããããããã£ãŠãb
åã®å€ã¯ãc
åãš d
åã®å€ãäžæžãããŸããåŸã£ãŠã0, 1, 0, 0
ã®è©³çŽ°åºŠã¯ã0, 0, 10, 10
ããäžã§ãã
çãã詳现床ã®å ŽåïŒæåŸã«äžããããã«ãŒã«ãé©çšãããŸããïŒå éšãŸãã¯å€éšã«é¢ä¿ãªãïŒã¹ã¿ã€ã«ã·ãŒãã«åãã«ãŒã«ã 2 åæžããå Žåãã¹ã¿ã€ã«ã·ãŒãã®ããäžéšã«æžãããã«ãŒã«ããã詳现床ãé«ããšã¿ãªããé©çšãããŸãã
ç§ã¯äœè©³çŽ°åºŠã® CSS ã«ãŒã«ãäœæããŠãå¿
èŠã«å¿ããŠç°¡åã«äžæžãã§ããããã«ããŠããŸããCSS ã® UI ã³ã³ããŒãã³ãã©ã€ãã©ãªã®ã³ãŒããèšè¿°ããéã«ã¯ã詳现床ãäœãããšãéèŠã§ãã詳现床ãäžããããã ãã«è€éããã CSS ã«ãŒã«ã䜿çšãããã!important
ãå©çšãããããšã¯é¿ããã¹ããªã®ã§ãã
- https://www.smashingmagazine.com/2007/07/css-specificity-things-you-should-know/
- https://www.sitepoint.com/web-foundations/specificity/
"ãªã»ãã" ãš "ããŒãã©ã€ãº" CSS ã®éãã¯äœã§ããïŒããªãã¯ã©ã¡ãã䜿ããŸããïŒãããŠããã¯ãªãã§ããïŒ
- ãªã»ãã - ãªã»ãããšã¯ãèŠçŽ ã®ãã¹ãŠã®ããã©ã«ããã©ãŠã¶ã¹ã¿ã€ã«ãåé€ããããšãæå³ããŸããäŸãã°ã
margin
ãpadding
ãfont-size
ã¯å šãŠåãèŠçŽ ã«ãªã»ãããããŸããäžè¬çãªã¿ã€ãã°ã©ãã£ãŒèŠçŽ ã®ããã«ã¹ã¿ã€ãªã³ã°ãå宣èšããªããã°ãªããŸããã - ããŒãã©ã€ãº - ããŒãã©ã€ãºã§ã¯ããã¹ãŠã®ã¹ã¿ã€ã«ãåé€ããã®ã§ã¯ãªããæçšãªããã©ã«ãã¹ã¿ã€ã«ã¯ä¿æããŸããåãããŠãäžè¬çãªãã©ãŠã¶ã®äŸåé¢ä¿ã®ãã°ãä¿®æ£ããŸãã
ç§ã¯éåžžã«ã«ã¹ã¿ãã€ãºãããããŸãã¯äžè¬çã§ã¯ãªããã¶ã€ã³ã®ãµã€ããäœæããéã«ã¯ãªã»ãããéžæããŸãããããã®å Žåãèªåã®ã¹ã¿ã€ãªã³ã°ãããããè¡ãå¿ èŠããããããã©ã«ãã®ã¹ã¿ã€ãªã³ã°ãä¿åããå¿ èŠããªãããã§ãã
Float 㯠CSS ã®äœçœ®æ±ºãããããã£ã§ãããããŒãèŠçŽ ã¯ããŒãžã®æµãã®äžéšãšããŠæ®ããããŒãžã®ãããŒããåé€ããã position: absolute
èŠçŽ ãšã¯ç°ãªããä»ã®èŠçŽ ïŒããšãã°ããããŒãèŠçŽ ã®åšããæµããããã¹ãïŒã®é
眮ã«åœ±é¿ããŸãã
CSS ã® clear
ããããã£ã¯ãleft
/right
/both
ãããŒãèŠçŽ ã®äžã«é
眮ããããã«äœ¿çšã§ããŸãã
芪èŠçŽ ã«ãããŒãèŠçŽ ã ããå«ãŸããŠããå Žåããã®é«ãã¯äœãæããããŸããŸãããããã¯ããããŒãã®åŸã®ãããŒããã³ã³ããã®äžã§ãã³ã³ãããéããåã«ã¯ãªã¢ããããšã§ä¿®æ£ã§ããŸãã
.clearfix
ããã¯ã¯ãå·§åŠãª CSS ç䌌ã»ã¬ã¯ã¿ïŒ:after
ïŒã䜿ã£ãŠãããŒããã¯ãªã¢ããŸãã芪ã«ãªãŒããŒãããŒãèšå®ããã®ã§ã¯ãªããã¯ã©ã¹ clearfix
ãè¿œå ããŸãã次ã«ããã® CSS ãé©çšããŸãïŒ
.clearfix:after {
content: ' ';
visibility: hidden;
display: block;
height: 0;
clear: both;
}
ãããã¯ã芪èŠçŽ ã« overflow: auto
ãŸã㯠overflow: hidden
ããããã£ãäžãããšãåèŠçŽ ã®äžã«æ°ãããããã¯æžåŒèšå®ã³ã³ããã¹ãã確ç«ãããåèŠçŽ ãå«ãããã«å±éãããŸãã
z-index
ãšã¯äœããšãã¹ã¿ãã¯ã³ã³ããã¹ã(ã¹ã¿ãã¯æè)ãã©ã®ããã«äœãããã®ããæããŠãã ããã
CSS ã® z-index
ããããã£ã¯ãéãªã£ãŠããèŠçŽ ã®åçŽæ¹åã®ç©ã¿éãé åºãå¶åŸ¡ããŸããz-index
㯠static
ã§ã¯ãªã position
å€ãæã€èŠçŽ ã«ã®ã¿åœ±é¿ããŸãã
z-index
å€ããªããã°ãèŠçŽ 㯠DOM ã«çŸããé çªã§ã¹ã¿ãã¯ãããŸãïŒåãéå±€ã¬ãã«ã®äžäœã®ãã®ãäžçªäžã«è¡šç€ºãããŸãïŒãéçã§ãªãäœçœ®ä»ãã®èŠçŽ ïŒããã³ãããã®åèŠçŽ ïŒã¯ãHTML éå±€ã«é¢ä¿ãªããåžžã«ããã©ã«ãã®éçé
眮ãæã€èŠçŽ ã®äžã«è¡šç€ºãããŸãã
ã¹ã¿ãã¯ã³ã³ããã¹ã(ã¹ã¿ãã¯æè)ã¯ãäžé£ã®ã¬ã€ã€ãŒãå«ãèŠçŽ ã§ããããŒã«ã«ã¹ã¿ããã³ã°ã³ã³ããã¹ãã§ã¯ããã®åã® z-index
å€ã¯ããã¥ã¡ã³ãã«ãŒãã§ã¯ãªãããã®èŠçŽ ã«çžå¯ŸããŠèšå®ãããŸãããã®ã³ã³ããã¹ãå€ã®ã¬ã€ã€ãŒãã€ãŸãããŒã«ã«ã¹ã¿ããã³ã°ã³ã³ããã¹ãã®å
åŒèŠçŽ ã¯ãã¬ã€ã€ãŒå
ã«ã¬ã€ã€ãŒã眮ãããšã¯ã§ããŸãããèŠçŽ B ãèŠçŽ A ã®äžã«åº§ã£ãŠããå ŽåãèŠçŽ C ã®åèŠçŽ ã¯èŠçŽ B ãããé«ããªãããšã¯ãããŸããã
åã¹ã¿ããã³ã°ã³ã³ããã¹ãã¯èªå·±å®çµåã§ããèŠçŽ ã®å
容ãç©ã¿éããããåŸãèŠçŽ å
šäœã芪ã¹ã¿ããã³ã°ã³ã³ããã¹ãã®ç©ã¿éãé ã«èæ
®ãããŸããããã€ãã® CSS ããããã£ã¯ã1 æªæºã® opacity
ãnone
ã§ã¯ãªã filter
ãnone
ã§ãªã transform
ã®ãããªæ°ããã¹ã¿ããã³ã°ã³ã³ããã¹ããåŒãèµ·ãããŸãã
- https://css-tricks.com/almanac/properties/z/z-index/
- https://philipwalton.com/articles/what-no-one-told-you-about-z-index/
- https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Positioning/Understanding_z_index/The_stacking_context (è±èª)
- https://developer.mozilla.org/ja/docs/Web/Guide/CSS/Understanding_z_index/The_stacking_context (æ¥æ¬èª)
ãããã¯æŽåœ¢æèïŒBlock Formatting Context: BFCïŒãšãã®ä»çµã¿ãæããŠãã ããã
ãããã¯æŽåœ¢æèïŒBlock Formatting Context: BFCïŒã¯ããããã¯ããã¯ã¹ãé
眮ããã Web ããŒãžã®ããžã¥ã¢ã« CSS ã¬ã³ããªã³ã°ã®äžéšã§ãããããŒãã絶察é
眮èŠçŽ ãinline-blocks
ãtable-cells
ãtable-caption
ãvisible
以å€ã® overflow
ãæã€èŠçŽ ïŒãã®å€ããã¥ãŒããŒãã«äŒæãããæãé€ãïŒæžåŒèšå®ã³ã³ããã¹ãããããã¯ããŸãã
BFC ã¯ã以äžã®æ¡ä»¶ã®å°ãªããšã 1 ã€ãæºãã HTML ããã¯ã¹ã§ãã
float
ã®å€ã¯none
ã§ã¯ãããŸãããposition
ã®å€ã¯static
ã§ãrelative
ã§ããããŸãããdisplay
ã®å€ã¯table-cell
ãtable-caption
ãinline-block
ãflex
ãinline-flex
ã§ããoverflow
ã®å€ã¯visible
ã§ã¯ãããŸããã
BFC ã§ã¯ãåããã¯ã¹ã®å·Šç«¯ãå å«ãããã¯ã®å·Šç«¯ã«æ¥ããŸãïŒå³ããå·Šãžã®æžåŒèšå®ãå³ç«¯ããã®ã¿ããïŒã
BFC ã厩å£ãããšãã«é£æ¥ãããããã¯ã¬ãã«ããã¯ã¹éã®åçŽããŒãžã³ã§ãã詳ãã㯠collapsing margins ãèªãã§ãã ããã
- https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Block_formatting_context (è±èª)
- https://developer.mozilla.org/ja/docs/Web/CSS/Block_formatting_context (æ¥æ¬èª)
- https://www.sitepoint.com/understanding-block-formatting-contexts-in-css/
clear ãè¡ãææ³ã«ã¯ã©ã®ãããªãã®ããããããããã©ã®ãããªç¶æ³ã«é©ããŠããŸããïŒ
- 空ã®
div
ã¡ãœãã -<div style="clear:both;"></div>
- Clearfix ã¡ãœãã - äžèšã®
.clearfix
ã¯ã©ã¹ãåç §ããŠãã ããã overflow: auto
ãŸãã¯overflow: hidden
ã¡ãœãã - 芪ã¯æ°ãããããã¯æžåŒèšå®ã³ã³ããã¹ãã確ç«ããfloat ãããåãå«ãããã«å±éããŸãã
倧èŠæš¡ãªãããžã§ã¯ãã§ã¯ããŠãŒãã£ãªã㣠.clearfix
ã¯ã©ã¹ãäœæããå¿
èŠãªå Žæã§äœ¿çšããŸããåäŸã芪ãããèãé«ããããã»ã©çæ³çã§ãªãå Žåãoverflow: hidden
ã¯åäŸãã¯ãªãããããããããŸããã
CSS ã¹ãã©ã€ããšã¯äœã§ããïŒããŒãžããµã€ãã«å®è£ ããæ¹æ³ãåãããŠèª¬æããŠãã ããã
CSS ã¹ãã©ã€ãã¯ãè€æ°ã®ã€ã¡ãŒãžã 1 ã€ã®å€§ããªã€ã¡ãŒãžã«çµåããŸããããã¯äžè¬çã«ã¢ã€ã³ã³çšã®æè¡ã§ãïŒGmail ã䜿çšããŠããŸãïŒããããå®è£ ããæ¹æ³ïŒ
- ã¹ãã©ã€ããžã§ãã¬ãŒã¿ã䜿çšããŠãè€æ°ã®ç»åã 1 ã€ã«ãŸãšããé©å㪠CSS ãçæããŸãã
- ããããã®ã€ã¡ãŒãžã¯ã
background-image
ãbackground-position
ãšbackground-size
ããããã£ãå®çŸ©ãããã察å¿ãã CSS ã¯ã©ã¹ãæã¡ãŸãã - ãã®ã€ã¡ãŒãžã䜿çšããã«ã¯ã察å¿ããã¯ã©ã¹ãèŠçŽ ã«è¿œå ããŸãã
å©ç¹:
- è€æ°ã®ã€ã¡ãŒãžã«å¯Ÿãã HTTP ãªã¯ãšã¹ãã®æ°ãæžããïŒã¹ãã©ã€ãã·ãŒãããšã« 1 åã®ãªã¯ãšã¹ãã 1 åã ãå¿ èŠïŒãããããHTTP2 ã§ã¯è€æ°ã®ã€ã¡ãŒãžãèªã¿èŸŒãããšã¯ãã¯ã倧ããªåé¡ã«ã¯ãªããŸããã
- å¿
èŠãªãŸã§ããŠã³ããŒããããªãã¢ã»ããã®äºåããŠã³ããŒããäŸãã°ã
:hover
ç䌌ã¹ããŒãã«ã®ã¿çŸããã€ã¡ãŒãžãç¹æ» ã¯èŠãããªãã
ãã©ãŠã¶åºæã®ã¹ã¿ã€ãªã³ã°ã«é¢ããåé¡ã解決ããã«ã¯ã©ãããã°ããã§ããïŒ
- åé¡ãç¹å®ããŠåé¡ã®ãã©ãŠã¶ãç¹å®ãããããã®ç¹å®ã®ãã©ãŠã¶ã䜿çšãããŠãããšãã«ã®ã¿ããŒãããå¥ã®ã¹ã¿ã€ã«ã·ãŒãã䜿çšããŸãããã®ææ³ã§ã¯ããµãŒããŒåŽã®ã¬ã³ããªã³ã°ãå¿ èŠã§ãã
- ãããã®ã¹ã¿ã€ãªã³ã°ã®åé¡ãæ¢ã«åŠçããŠãã Bootstrap ã®ãããªã©ã€ãã©ãªã䜿çšããŠãã ããã
- ãã³ããŒãã¬ãã£ãã¯ã¹ãã³ãŒãã«èªåçã«è¿œå ããã«ã¯ã
autoprefixer
ã䜿çšããŸãã - Reset CSS ãŸã㯠Normalize.css ã䜿çšããŠãã ããã
æ©èœã®å°ãªããã©ãŠã¶ã«å¯ŸããŠã¯ãã©ã®ããã«ããŒãžãæäŸããŸããïŒã©ã®ãããªãã¯ããã¯/ããã»ã¹ã䜿çšããŸããïŒ
- ã°ã¬ãŒã¹ãã«ã»ãã°ã©ããŒã·ã§ã³ïŒGraceful degradationïŒ - ææ°ã®ãã©ãŠã¶ãŒçšã®ã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ããå€ããã©ãŠã¶ãŒã§ã¯æ©èœãç¶ããããšãä¿èšŒããç¿æ £ã
- ããã°ã¬ãã·ãã»ãšã³ãã³ã¹ïŒProgressive EnhancementïŒ - åºæ¬ã¬ãã«ã®ãŠãŒã¶ãŒãšã¯ã¹ããªãšã³ã¹ã®ããã®ã¢ããªã±ãŒã·ã§ã³ãæ§ç¯ãããããã©ãŠã¶ãŒãããããµããŒããããšãã«æ©èœæ¡åŒµãè¿œå ãããã©ã¯ãã£ã¹ã
- æ©èœã®ãµããŒãã確èªããã«ã¯ãcaniuse.com ã䜿çšããŠãã ããã
- èªåãã³ããŒæ¥é èŸæ¿å ¥ã®ããã®*ãªãŒããã¬ãã£ã¯ãµãŒã
- Modernizr ã䜿ã£ãæ©èœã®æ€åº
ã³ã³ãã³ããèŠèŠçã«é ãïŒã¹ã¯ãªãŒã³ãªãŒããŒã®ã¿å©çšå¯èœã«ããïŒæ¹æ³ã«ã¯ã©ã®ãããªãã®ããããŸããïŒããã€ãæããŠãã ããã
ãããã®æè¡ã¯ã¢ã¯ã»ã·ããªãã£ïŒa11yïŒã«é¢é£ããŠããŸãã
visibility: hidden
ïŒ ããããèŠçŽ ã¯ãŸã ããŒãžã®æµãã«ããããŸã 空éãå ããŠããŸããwidth: 0; height: 0
ïŒ èŠçŽ ãç»é¢äžã®ã¹ããŒã¹ãå šãå ããªãããã«ããŠãããã衚瀺ããªãããã«ããŸããposition: absolute; left: -99999px
ïŒ ç»é¢ã®å€åŽã«é 眮ããŸããtext-indent: -9999px
ïŒ ããã¯block
èŠçŽ å ã®ããã¹ãã«å¯ŸããŠã®ã¿æ©èœããŸãã- ã¡ã¿ããŒã¿ïŒ ããšãã°ãSchema.orgãRDFãJSON-LD ã䜿çšããŸãã
- WAI-ARIAïŒ Web ããŒãžã®ã¢ã¯ã»ã·ããªãã£ãåäžãããæ¹æ³ãæå®ãã W3C ã®æè¡ä»æ§ã
WAI-ARIA ãçæ³çãªè§£æ±ºçãããããŸããããç§ã¯ absolute
ã«ããäœçœ®æ±ºå®ææ³ãæ¡çšããŠããŸãã泚æãã¹ãããšãå°ãªããã»ãšãã©ã®èŠçŽ ã«å¯Ÿå¿ããŠããç°¡åãªææ³ã ããã§ãã
- https://www.w3.org/TR/wai-aria-1.1/
- https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA (è±èª)
- https://developer.mozilla.org/ja/docs/Web/Accessibility/ARIA (æ¥æ¬èª)
- http://a11yproject.com/
ã°ãªããã·ã¹ãã ã䜿çšããããšããããŸããïŒäœ¿ã£ãããšããããªããããªãã¯ã©ã®ã°ãªããã·ã¹ãã ã奜ãã§ããïŒ
ç§ã¯ float
ããŒã¹ã®ã°ãªããã·ã¹ãã ã奜ãã§ãããªããªããæ¢åã®ä»£æ¿ã·ã¹ãã ïŒãã¬ãã¯ã¹ãã°ãªããïŒã®äžã§ãæãå€ãã®ãã©ãŠã¶ããµããŒãããŠããããã§ããããŒãã¹ãã©ããã§é·å¹Žäœ¿çšãããŠãããåäœããããšã蚌æãããŠããŸãã
ã¡ãã£ã¢ã¯ãšãªãã¢ãã€ã«åºæã®ã¬ã€ã¢ãŠã/CSS ã䜿çšãããå®è£ ããããšã¯ãããŸããïŒ
ã¯ããäžäŸã¯ããã«åããã²ãŒã·ã§ã³ããç¹å®ã®ãã¬ãŒã¯ãã€ã³ããè¶ããåºå®åºã®ã¿ãåããã²ãŒã·ã§ã³ã«å€æããããšã§ããã
ããã...æ²ããããšã«ã
ã¯ãã@media ããããã£ã«ã¯ screen
ãå«ããŠïŒã€ã®çš®é¡ããããŸãã:
all
- å šãŠã®ããã€ã¹print
- ããªã³ã¿ãŒspeech
- ããŒãžãèªã¿äžããã¹ã¯ãªãŒã³ãªãŒããŒscreen
- ã³ã³ãã¥ãŒã¿ã¹ã¯ãªãŒã³ãã¿ãã¬ãããã¹ããŒããã©ã³ãªã©
print
ã¡ãã£ã¢ã¿ã€ãã®äœ¿ãæ¹ã®äŸ:
@media print {
body {
color: black;
}
}
å¹çç㪠CSS ãæžãã«ããã«é¿ããã¹ã "èœãšãç©Ž" ã«ã¯ã©ããªãã®ããããŸããïŒ
ãŸãããã©ãŠã¶ãã»ã¬ã¯ã¿ãå³ç«¯ïŒããŒã»ã¬ã¯ã¿ïŒããå·Šã«äžèŽãããããšãç解ããŠãã ããããã©ãŠã¶ã¯ããŒã»ã¬ã¯ã¿ã«åŸã£ãŠ DOM å ã®èŠçŽ ããã£ã«ã¿ãªã³ã°ãã芪èŠçŽ ãèµ°æ»ããŠäžèŽãå€å®ããŸããã»ã¬ã¯ã¿ãŒãã§ãŒã³ã®é·ããçãã»ã©ããã©ãŠã¶ãŒã¯ãã®ãšã¬ã¡ã³ããã»ã¬ã¯ã¿ãŒãšäžèŽãããã©ãããå€å¥ããããšãã§ããŸãããããã£ãŠãã¿ã°ã»ã¬ã¯ã¿ãšãŠãããŒãµã«ã»ã¬ã¯ã¿ã§ããããŒã»ã¬ã¯ã¿ã¯é¿ããŠãã ããããããã¯å€æ°ã®èŠçŽ ã«ããããããã©ãŠã¶ã¯èŠªãããããããã©ãããå€æããããã«å€ãã®äœæ¥ãããå¿ èŠããããŸãã
BEM (Block Element Modifier)ã®æ¹æ³è«ã§ã¯ããã¹ãŠãåäžã®ã¯ã©ã¹ãæã¡ãéå±€ãå¿ èŠãªå Žåã¯ã¯ã©ã¹åã«ãçŒãä»ããããããšãæšå¥šãããŠããŸããã»ã¬ã¯ã¿ã¯å¹ççãã€ç°¡åã«ãªãŒããŒã©ã€ãã§ããŸãã
ã©ã® CSS ããããã£ããªãããŒãåæç»ãããã³åæãããªã¬ãããã«æ³šæããŠãã ãããå¯èœã§ããã°ãã¬ã€ã¢ãŠãïŒããªã¬ãŒãªãããŒïŒãå€æŽããã¹ã¿ã€ã«ãæžãã®ã¯é¿ããŠãã ããã
CSS ããªããã»ããµã䜿çšããã¡ãªãããšãã¡ãªããã«ã¯äœããããŸããïŒ
ã¡ãªãã:
- CSS ã®ã¡ã³ããã³ã¹æ§ãåäžããŸããã
- ãã¹ããããã»ã¬ã¯ã¿ãæžããããã
- äžè²«ããããŒãèšå®ã®ããã®å€æ°ãç°ãªããããžã§ã¯ãéã§ããŒããã¡ã€ã«ãå ±æã§ããŸãã
- ããã¯ã¹ã€ã³ã¯ç¹°ãè¿ã CSS ãçæããŸãã
- ããªãã®ã³ãŒããè€æ°ã®ãã¡ã€ã«ã«åå²ãããCSS ãã¡ã€ã«ãåå²ããããšãã§ããŸããããã®ããã«ã¯å CSS ãã¡ã€ã«ãããŠã³ããŒãããããã® HTTP ãªã¯ãšã¹ããå¿ èŠã§ãã
ãã¡ãªãã:
- ååŠçã®ããã®ããŒã«ãå¿ èŠã§ããåã³ã³ãã€ã«æéãé ããªãããšããããŸãã
䜿çšããããšã®ãã CSS ããªããã»ããµã«ã€ããŠå¥œããªãã®ãšå«ããªãã®ãæããŠãã ããã
奜ããªãã®:
- äž»ã«äžèšã®å©ç¹ã
- Less 㯠JavaScript ã§æžãããŠãããNode ã§ããŸããããŸãã
å«ããªãã®:
- C++ ã§æžããã LibSass ã®ãã€ã³ãã£ã³ã°ã§ãã
node-sass
ã䜿ã£ãŠ Sass ã䜿çšããŸããããŒãã®ããŒãžã§ã³ãåãæ¿ãããšãã«ãé »ç¹ã«åã³ã³ãã€ã«ããå¿ èŠããããŸãã - Less ã§ã¯ãå€æ°åã®å
é ã«
@
ãä»ããŠããŸããããã¯@media
ã@import
ã@font-face
ã«ãŒã«ãªã©ã®ãã€ãã£ã CSS ããŒã¯ãŒããšæ··åããããšããããŸãã
éæšæºãã©ã³ãã䜿çšãã Web ãµã€ããå®è£ ããã«ã¯ã©ã®ããã«ããŸããïŒ
font-face
ã䜿ã£ãŠ font-weight
ã® font-family
ãå®çŸ©ããŠãã ããã
CSS ã»ã¬ã¯ã¿ã«ãããããèŠçŽ ãã©ããªã®ãããã©ãŠã¶ãã©ã®ããã«æ±ºå®ããŠãããã説æããŠãã ããã
ãã®éšåã¯äžèšã®å¹çç㪠CSS ã®èšè¿°ã«é¢ãããã®ã§ãããã©ãŠã¶ã¯ã»ã¬ã¯ã¿ãå³ç«¯ïŒããŒã»ã¬ã¯ã¿ïŒããå·Šã«äžèŽãããŸãããã©ãŠã¶ã¯ããŒã»ã¬ã¯ã¿ã«åŸã£ãŠ DOM å ã®èŠçŽ ããã£ã«ã¿ãªã³ã°ãã芪èŠçŽ ãèµ°æ»ããŠäžèŽãå€å®ããŸããã»ã¬ã¯ã¿ãã§ãŒã³ã®é·ããçããã°çãã»ã©ããã©ãŠã¶ããã®èŠçŽ ãã»ã¬ã¯ã¿ã«äžèŽãããã©ãããå€æããããšãã§ããŸãã
ããšãã°ããã®ã»ã¬ã¯ã¿ p span
ã§ã¯ããã©ãŠã¶ã¯ãŸããã¹ãŠã® <span>
èŠçŽ ãèŠã€ãããã®èŠªãã«ãŒããŸã§ãã¹ãŠãã©ããŒã¹ã㊠<p>
èŠçŽ ãæ¢ããŸããç¹å®ã® <span>
ã«ã€ããŠã¯ã<p>
ãèŠã€ãããšçŽã¡ã« <span>
ãããããããããã³ã°ãæ¢ããããšãã§ããŸãã
ç䌌èŠçŽ ã«ã€ããŠèª¬æãããããããªãã®ããã«äœ¿ãããŠãããã詳ãã話ããŠãã ããã
CSS ç䌌èŠçŽ ã¯ã»ã¬ã¯ã¿ã«è¿œå ãããããŒã¯ãŒãã§ãéžæããèŠçŽ ã®ç¹å®ã®éšåãã¹ã¿ã€ã«ããããšãã§ããŸããããŒã¯ã¢ãã(:before
, :after
)ãå€æŽããªããŠããããŒã¯ã¢ãã(combined with content: ...
)ãžã®èŠçŽ ã®è¿œå ããã³ã¬ãŒã·ã§ã³(:first-line
, :first-letter
) ã«äœ¿çšã§ããŸãã
:first-line
ãš:first-letter
ã䜿ã£ãŠããã¹ããè£ é£Ÿããããšãã§ããŸãã- äžèšã®
.clearfix
ããã¯ã§ãclear:both
ã§ãŒãã¹ããŒã¹ã®èŠçŽ ãè¿œå ããããã«äœ¿çšãããŸãã - ããŒã«ãããã®äžè§åœ¢ã®ç¢å°ã¯
:before
ãš:after
ã䜿ããŸããäžè§åœ¢ã¯å®éã«ã¯ DOM ã§ã¯ãªãã¹ã¿ã€ãªã³ã°ã®äžéšãšã¿ãªããããããæžå¿µã®åé¢ãä¿ããŸããè¿œå ã® HTML èŠçŽ ã䜿çšããã« CSS ã¹ã¿ã€ã«ã ãã§äžè§åœ¢ãæç»ããããšã¯ãå®éã«ã¯äžå¯èœã§ãã
ããã¯ã¹ã¢ãã«ããªãã§ãããã®ããªãã®ç解ãšãç°ãªãããã¯ã¹ã¢ãã«ã§ã¬ã€ã¢ãŠããã¬ã³ããªã³ã°ããããã« CSS ã§ãã©ãŠã¶ã«æ瀺ããæ¹æ³ã説æããŠãã ããã
CSS ããã¯ã¹ã¢ãã«ã¯ãããã¥ã¡ã³ãããªãŒå ã®èŠçŽ ã«å¯ŸããŠçæãããèŠèŠçãªæžåŒèšå®ã¢ãã«ã«åŸã£ãŠã¬ã€ã¢ãŠããããé·æ¹åœ¢ã®ããã¯ã¹ãèšè¿°ããŸããåããã¯ã¹ã¯ãå 容é åïŒäŸãã°ãããã¹ããç»åãªã©ïŒããã³ä»»æã®åšå²ã®ãããã£ã³ã°ãããããŒããŒãããã³ãããŒãžã³ãé åãæããã
CSS ããã¯ã¹ã¢ãã«ã¯ã次ã®èšç®ãè¡ããŸãã
- ãããã¯èŠçŽ ãã©ããããã®ã¹ããŒã¹ãå ãããã
- æ ç·ãäœçœãéãªããã©ããããŸãã¯æãããããã©ããã
- ããã¯ã¹ã®å¯žæ³ã
ããã¯ã¹ã¢ãã«ã«ã¯æ¬¡ã®èŠåããããŸãã
- ãããã¯èŠçŽ ã®å€§ããã¯ã
width
ãheight
ãpadding
ãborder
ããã³margin
ã«ãã£ãŠèšç®ãããŸãã height
ãæå®ãããŠããªãå Žåããããã¯èŠçŽ ã¯å«ãŸããŠããå 容ãšåããããé«ããªããŸãïŒãããŒãããªãéãã以äžåç §ïŒãwidth
ãæå®ãããŠããªãå ŽåããããŒãã®ãããã¯èŠçŽ ã¯ããã®èŠªã®å¹ ããpadding
ã®å¹ ã«åãŸãããã«å±éãããŸãã- èŠçŽ ã®
height
ã¯å 容ã®height
ã«ãã£ãŠèšç®ãããŸãã - èŠçŽ ã®
width
ã¯å 容ã®width
ã«ãã£ãŠèšç®ãããŸãã - ããã©ã«ãã§ã¯ã
padding
ãšborder
ã¯èŠçŽ ã®width
ãšheight
ã®äžéšã§ã¯ãããŸããã
- ããã©ã«ãã§ã¯ãèŠçŽ ã«ã¯
box-sizing: content-box
ãé©çšãããã³ã³ãã³ããµã€ãºã®ã¿ãèæ ®ãããŸãã box-sizingïŒborder-box
ã¯ãèŠçŽ ã®width
ãšheight
ãã©ã®ããã«èšç®ãããããå€æŽããborder
ãšpadding
ãèšç®ã«å«ããŸãã- èŠçŽ ã®
height
ã¯ãã³ã³ãã³ãã®height
+ åçŽpadding
+ åçŽborder
å¹ ã«ãã£ãŠèšç®ãããŸãã - èŠçŽ ã®
width
ã¯ãã³ã³ãã³ãã®width
+ æ°Žå¹³padding
+ æ°Žå¹³border
å¹ ã«ãã£ãŠèšç®ãããŸãã
CSS ã® display
ããããã£ãšã¯äœã§ããïŒãã®äœ¿ãæ¹ã®äŸãããã€ãæããããšãã§ããŸããïŒ
none
,block
,inline
,inline-block
,table
,table-row
,table-cell
,list-item
TODO
æ¯èŒã®ããã« block
ã䞊ã¹ãŸãã
block |
inline-block |
inline |
|
---|---|---|---|
ãµã€ãº | 芪èŠçŽ ã®å¹ ãšåãã«ãªãã | èŠçŽ ã«ãã£ãŠå€ããã | èŠçŽ ã«ãã£ãŠå€ããã |
ããžã·ã§ãã³ã° | æ°ããè¡ããå§ãŸããé£ã«èŠçŽ ã䞊ã¹ãããªãã(float ã䜿ãå Žåãé€ã) |
ä»ã®èŠçŽ ãšãããŒããé£ã«èŠçŽ ã䞊ã¹ãããšãã§ããã | ä»ã®èŠçŽ ãšãããŒããé£ã«èŠçŽ ã䞊ã¹ãããšãã§ããã |
width ãš height ã®æå®ãã§ããã |
ã¯ã | ã¯ã | ããããèšå®ãããŠãç¡èŠãããã |
vertical-align ãæå®ã§ããã |
ããã | ã¯ã | ã¯ã |
ããŒãžã³ãšããã£ã³ã° | äžäžå·Šå³ã«æå®ã§ããã | äžäžå·Šå³ã«æå®ã§ããã | å·Šå³ã®ã¿æå®å¯èœãäžäžã«æå®ãããŠãã¬ã€ã¢ãŠãã«åœ±é¿ã¯ãªãã border ãš padding ãèŠçŽ ã®åšãã«èŠèŠçã«çŸããŠããŠããäžäžã®ã¹ããŒã¹ã¯ line-height ã«ãã£ãŠæ±ºãŸãã |
ãããŒã | - | - | äžäžã® margins ãš paddings ãèšå®ã§ãã block èŠçŽ ã®ããã«ãªãã |
é
眮ãããèŠçŽ ã¯ãèšç®ããã position
ããããã£ã relative
ãabsolute
ãfixed
ãŸã㯠sticky
ã®ããããã§ããèŠçŽ ã§ãã
static
- ããã©ã«ãã®äœçœ®ã§ããèŠçŽ ã¯éåžžã©ããããŒãžã«æµããŸããtop
ãright
ãbottom
ãleft
ãz-index
ããããã£ã¯é©çšãããŸãããrelative
- èŠçŽ ã®äœçœ®ã¯ãã¬ã€ã¢ãŠããå€æŽããããšãªããããèªäœã«å¯ŸããŠçžå¯Ÿçã«èª¿æŽãããŸãïŒãããã£ãŠãé 眮ãããŠããªãã£ãèŠçŽ ã®ééãæ®ããŸãïŒãabsolute
- èŠçŽ ã¯ãããŒãžã®ãããŒããåé€ãããããããã°ãæãè¿ãäœçœ®ã«ããç¥å ã«å¯ŸããŠæå®ãããäœçœ®ã«çœ®ãããŸãã絶察é 眮ãããããã¯ã¹ã¯äœçœãæã€ããšãã§ããä»ã®äœçœãšäžç·ã«æãç³ãŸããããšã¯ãããŸããããããã®èŠçŽ ã¯ä»ã®èŠçŽ ã®äœçœ®ã«åœ±é¿ããŸãããfixed
- èŠçŽ ã¯ãããŒãžã®ãããŒããåé€ããããã¥ãŒããŒãã«å¯ŸããŠæå®ãããäœçœ®ã«é 眮ãããã¹ã¯ããŒã«ãããšç§»åããŸãããsticky
- ã¹ãã£ãããŒããžã·ã§ãã³ã°ã¯ãçžå¯Ÿäœçœ®ãšåºå®äœçœ®ã®ãã€ããªããã§ããèŠçŽ ã¯ãæå®ããããããå€ãè¶ ãããŸã§ãçžå¯Ÿçãªäœçœ®ãšããŠæ±ãããŸãããã®æç¹ã§ãfixed
ã®äœçœ®ãšããŠæ±ãããŸãã
- https://developer.mozilla.org/en/docs/Web/CSS/position (è±èª)
- https://developer.mozilla.org/ja/docs/Web/CSS/position (æ¥æ¬èª)
ããŒã«ã«ãæ¬çªç°å¢ã§ãã©ã®æ¢åã® CSS ãã¬ãŒã ã¯ãŒã¯ã䜿çšããŠããŸããïŒãŸããã©ã®ããã«å€æŽ/æ¹åããŠããŸããïŒ
- BootStrap - ç·©ãããªãªãªãŒã¹ãµã€ã¯ã«ãBootStrap4 ã¯ãã»ãŒ 2 幎éã¢ã«ãã¡ã«ãªã£ãŠããŸããåºã䜿çšãããŠããããã«ãã¹ãããŒãã¿ã³ã³ã³ããŒãã³ããè¿œå ããŸãã
- Semantic UI - ãœãŒã¹ã³ãŒãæ§é ã«ãããããŒãã®ã«ã¹ã¿ãã€ãºãéåžžã«é£ãããªããŸããæ £ç¿çã§ãªãããŒãèšå®ã·ã¹ãã ã§ã«ã¹ã¿ãã€ãºããã®ã¯é¢åã§ãããã³ãã©ã€ãã©ãªå ã®ããŒãã³ãŒããããèšå®ãã¹ãBootStrap ãšã¯éã£ãŠãå€æ°ããªãŒããŒã©ã€ãããããã«ããŸãèšèšãããŠããŸããã
- Bulma - éã»ãã³ãã£ãã¯ã§äœèšãªã¯ã©ã¹ãããŒã¯ã¢ãããå¿ èŠã§ããäžäœäºææ§ããããŸãããããŒãžã§ã³ãã¢ããã°ã¬ãŒããããšã埮åŠãªæ¹æ³ã§ã¢ããªãå£ããŠããŸããŸãã
ã¯ããFlexbox ã¯äž»ã« 1 次å ã¬ã€ã¢ãŠããæå³ããGrid 㯠2 次å ã¬ã€ã¢ãŠããæå³ããŸãã
Flexbox ã¯ãã³ã³ããå
ã®èŠçŽ ã®åçŽæ¹åã®ã»ã³ã¿ãªã³ã°ãã¹ãã£ãããŒããã¿ãŒãªã©ãCSS ã®å€ãã®äžè¬çãªåé¡ã解決ããŸããããŒãã¹ãã©ãããš Bulma 㯠Flexbox ãããŒã¹ã«ããŠããŸããFlexbox ãè©ŠããŠã¿ãŸããããflex-grow
ã䜿ã£ãŠããã€ãã®ãã©ãŠã¶ã®éäºææ§åé¡ïŒSafariïŒã«ééããŸããããã㊠inline-blocks
ãš % ã§å¹
ãèšç®ããã³ãŒããæžãçŽããªããã°ãªããŸããã§ããã
ã°ãªããã¯ãã°ãªããããŒã¹ã®ã¬ã€ã¢ãŠããäœæããããã®æãçŽèŠ³çãªã¢ãããŒãã§ãïŒããè¯ãïŒïŒãããã©ãŠã¶ã®ãµããŒãã¯çŸæç¹ã§ã¯åºãã¯ãããŸããã
ãŠã§ããµã€ããã¬ã¹ãã³ã·ãã§ã³ãŒãã£ã³ã°ããããšãšã¢ãã€ã«ãã¡ãŒã¹ãã§ã³ãŒãã£ã³ã°ããããšã®éãã説æã§ããŸããïŒ
TODO
å¿çæ§ãšé©å¿æ§ã®äž¡æ¹ã®èšèšã§ã¯ãããŸããŸãªããã€ã¹éã§ãŠãŒã¶ãŒãšã¯ã¹ããªãšã³ã¹ãæé©åããç°ãªããã¥ãŒããŒããµã€ãºã解å床ã䜿çšç¶æ³ãå¶åŸ¡ã¡ã«ããºã ãªã©ã調æŽããŸãã
ã¬ã¹ãã³ã·ããªãã¶ã€ã³ã¯ãæè»æ§ã®åå - ãã¹ãŠã®ããã€ã¹ã§èŠãç®ããããªãåäžã®æµäœãŠã§ããµã€ã - ã§åäœããŸããã¬ã¹ãã³ã·ããªãŠã§ããµã€ãã¯ãã¡ãã£ã¢ã¯ãšãªããã¬ãã·ãã«ã°ãªãããããã³åå¿æ§ã®é«ãã€ã¡ãŒãžã䜿çšããŠãå€æ°ã®èŠå ã«åºã¥ããŠæè»ã«å€åãããŠãŒã¶ãŒãšã¯ã¹ããªãšã³ã¹ãäœãåºããŸãã1 ã€ã®ããŒã«ãæé·ããããåçž®ããŠè€æ°ã®ç°ãªãããŒãã«åãŸãããã«ããŸãã
ã¢ãããã£ãã»ãã¶ã€ã³ã¯ãããã°ã¬ãã·ãã»ãšã³ãã³ã¹ã¡ã³ãã®çŸä»£çå®çŸ©ã«ãã£ãšäŒŒãŠããŸãæè»ãªãã¶ã€ã³ã§ã¯ãªããããã€ã¹ããã®ä»ã®æ©èœãæ€åºãããããããå®çŸ©ãããäžé£ã®ãã¥ãŒããŒããµã€ãºããã®ä»ã®ç¹æ§ã«åºã¥ããŠé©åãªæ©èœãšã¬ã€ã¢ãŠããæäŸããŸãããµã€ãã¯äœ¿çšãããŠããããã€ã¹ã®ã¿ã€ããæ€åºãããã®ããã€ã¹ã®ããªã»ããã¬ã€ã¢ãŠããé ä¿¡ããŸãã1 ã€ã®ããŒã«ãããã€ãã®ç°ãªããµã€ãºã®ããŒããééãã代ããã«ãããŒããµã€ãºã«å¿ããŠããã€ãã®ç°ãªãããŒã«ã䜿çšã§ããŸãã
- https://developer.mozilla.org/en-US/docs/Archive/Apps/Design/UI_layout_basics/Responsive_design_versus_adaptive_design (è±èª)
- https://developer.mozilla.org/ja/docs/Archive/Apps/Design/UI_layout_basics/Responsive_design_versus_adaptive_design (æ¥æ¬èª)
- http://mediumwell.com/responsive-adaptive-mobile/
- https://css-tricks.com/the-difference-between-responsive-and-adaptive-design/
Retina 察å¿ãè¡ã£ãããšã¯ãããŸããïŒãããããªãããã€ã©ã®ãããªãã¯ããã¯ã䜿ããŸãããïŒ
ç§ã¯ Retina ãã£ã¹ãã¬ã€ãæ±ãããã«é«è§£å床ã®ã°ã©ãã£ãã¯ã¹ïŒãã£ã¹ãã¬ã€ãµã€ãºã® 2 åïŒã䜿çšããåŸåããããŸããããè¯ãæ¹æ³ã¯ @media only screen and (min-device-pixel-ratio: 2) { ... }
ã®ãããªã¡ãã£ã¢ã¯ãšãªã䜿çšããbackground-image
ãå€æŽããããšã§ãã
ã¢ã€ã³ã³ã«ã€ããŠã¯ã解å床ã«é¢ä¿ãªãéåžžã«é®®æã«è¡šç€ºããããããå¯èœã§ããã° svgs ãšã¢ã€ã³ã³ãã©ã³ãã䜿çšããããšãéžæããŸãã
ããäžã€ã®æ¹æ³ã¯ JavaScript ã䜿ã£ãŠã<img>
src
å±æ§ã window.devicePixelRatio
å€ããã§ãã¯ããåŸãããé«è§£å床ã®ããŒãžã§ã³ã«çœ®ãæããããšã§ãã
position: absolute
ã®ä»£ããã« translate()
ã䜿çšããã¹ãå Žåã¯ãããŸããïŒãã®éã®å ŽåããããŸããïŒçç±ãåãããŠæããŠãã ããã
translate()
㯠CSS 㮠transform
ã®å€ã§ããtransform
ã opacity
ãå€æŽããŠãããã©ãŠã¶ã®ãªãããŒãåæç»ã¯è¡ããããã³ã³ããžã·ã§ã³ã®ã¿ãããªã¬ãããŸããtransform
ã¯ãã©ãŠã¶ã«èŠçŽ ã® GPU å±€ãäœæãããŸããã絶察é
眮ããããã£ãå€æŽãããš CPU ã䜿çšããŸãããããã£ãŠãtranslate()
ã¯ããå¹ççã§ãããããæ»ãããªã¢ãã¡ãŒã·ã§ã³ã®ããã®ãã€ã³ãæéãççž®ããŸãã
translate()
ã䜿çšãããšãèŠçŽ ã¯çµ¶å¯Ÿäœçœ®ãå€æŽããã®ãšã¯ç°ãªããå
ã®ã¹ããŒã¹ã䜿ããŸãïŒposition: relative
ã®ãããªãã®ïŒã