ã¯ããã«
èªè ã®çæ§ããã®èšäºã¯ãã¬ã€ã¢ãŠãã«é¢ããèšäºã·ãªãŒãºã®ç¬¬2éšã§ãã
æåã®éšåã§ã¯ãçŽç²ãªHTMLããã³CSSã®æšæºããŒã«ã䜿çšããŠãPcklaboratoryã®Corporate Blueãã³ãã¬ãŒããäœæããŸããã ãã®èšäºã§ã¯ãåããã³ãã¬ãŒããäœæããããšããŸãããCSSãã¬ãŒã ã¯ãŒã¯Bootstrap 3ã䜿çšããŸãã
CSSãã¬ãŒã ã¯ãŒã¯ã䜿çšããå©ç¹ã¯ãã¬ã€ã¢ãŠãèšèšè ãããã¬ãŒã ã¯ãŒã¯ã®äœæè ãæ¢ã«èããŠããã¬ã€ã¢ãŠãã®å€ãã®ãã¥ã¢ã³ã¹ãèæ ®ããå¿ èŠããªãããšã§ãã ãã®ãããªãã¥ã¢ã³ã¹ã«ã¯ããã©ãŠã¶ãŒéã®äºææ§ãããŸããŸãªç»é¢è§£å床ã®ãµããŒããªã©ãå«ãŸããŸãã ã¿ã€ãã»ãã¿ãŒã¯ããã¬ãŒã ã¯ãŒã¯èªäœã®æ®ãã®éšåã衚瀺ã®æ¹æ³ãšã¿ã€ãã³ã°ã瀺ãã ãã§ãã ãã®ã¢ãããŒãã«ããããµã€ãã®ã¬ã€ã¢ãŠããå€§å¹ ã«é«éåã§ããŸãã Bootstrapã®å©ç¹ã«ã¯ããã®äººæ°ãå«ãŸããŸãã ããã¯ãå¥ã®ã¬ã€ã¢ãŠããã¶ã€ããŒãã³ãŒãããµããŒãããã®ãç°¡åã«ãªãããšãæå³ããŸãã
ãã¬ãŒã ã¯ãŒã¯ã䜿çšããããšã®æ¬ ç¹ã¯ãããŒãžããã¬ãŒã ã¯ãŒã¯ã®ããäžéšãã䜿çšããªãå Žåã§ãããã¬ãŒã ã¯ãŒã¯ã®äœåãªã¹ã¿ã€ã«ãå®å šã«ãéã¶ãå¿ èŠããããšããäºå®ã§ãã ãã®ãã¬ãŒã ã¯ãŒã¯ã¯ã管çããŒãžãªã©ããã¶ã€ã³ãäºæ¬¡çãªããŒãžã®ãããã¿ã€ãã³ã°ãšäœæã«æé©ãªããŒã«ã§ãã éåžžã«å ·äœçãªèšèšãããå Žåããã€ãã£ãããŒã«ããããã¬ãŒã ã¯ãŒã¯ã䜿çšããŠæ§æããã®ãé£ããå ŽåããããŸãã ããã«ãããããããããã¯å¯èœã§ãã
ããŒãã¹ãã©ããã®äœ¿çšã«ã€ããŠ
çŸåšãBootstrapã¹ã¿ã€ã«ã䜿çšããæ¹æ³ã¯ããã€ããããŸãã
LESSã䜿çšããªã
åå¿è ã«ã¯ãBootstrapèªäœã次ã®ã¢ãããŒããæšå¥šããŠããŸããã³ã³ãã€ã«æžã¿ã®Bootstrapããµã€ãããããŠã³ããŒãããäœãå€æŽããã«ãããžã§ã¯ãã«å ¥ããå¿ èŠããããŸãã 次ã«ã空ã®CSSãã¡ã€ã«ãäœæããbootstrap.cssã®åŸã«æ·»ä»ããå¿ èŠããããŸãã
<link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/styles.css" rel="stylesheet">
ãã®åŸãBootstrapã¹ã¿ã€ã«ãå€æŽããã«ã¯ãstyles.cssã§æ¬¡ã®åœ¢åŒã§ãããã匷å¶çµäºããå¿ èŠããããŸãã
a { color: #beceda; }
ãã®ã¢ãããŒãã®æãããªæ¬ ç¹ã¯ãäžæããå¿ èŠãããå¿ èŠãªã¹ã¿ã€ã«ãæåã§æ€çŽ¢ããå¿ èŠãããããšã§ããããã¯å¿ ãããç°¡åã§ã¯ãªãããã§ãã äžéšã®Bootstrapãã©ã¡ãŒã¿ãŒã¯ãå€æŽããã圢åŒã§ãããšãã°æ°åŒãä»ããŠãå€ãã®ã»ã¬ã¯ã¿ãŒã«é©çšãããŸãã ããã§ã¯ã ã«ã¹ã¿ãã€ãºããŒã«ã¯ã»ãšãã©åœ¹ã«ç«ã¡ãŸãããå€æŽãæ£ããã³ã³ãã€ã«ããã®ã«åœ¹ç«ã¡ãŸãããäžåºŠã ãã§ãã å°æ¥ãããã€ãã®ãã©ã¡ãŒã¿ãŒãå€æŽããå Žåã¯ãã¹ã¿ã€ã«ãã³ã³ãã€ã«ããããã«ããã¹ãŠã®ãã£ãŒã«ãã®å€æŽãããå€ãåé§åããå¿ èŠããããŸãã
LESSã®äœ¿çš
ãã®ã¡ãœããã¯ããã¹ãŠã®Bootstrapå€æ°ã.lessãã¡ã€ã«ã«ä¿åãããŠããããšãåæãšããŠããŸãã éçºè ã¯ãããã®å€æ°ãæäœããå¿ èŠã«å¿ããŠæåãŸãã¯èªåã§CSSãã¡ã€ã«ã«ã³ã³ãã€ã«ããŸããHTMLèªäœã«ã¯ã³ã³ãã€ã«æžã¿ã®CSSãã¡ã€ã«ã®ã¿ãå«ãŸããŸãã ãã®èšäºã§æãæè»æ§ãé«ããšèŠãªãããã®ã¯ããã®ãªãã·ã§ã³ã§ãã
LESSãã¡ã€ã«ãã³ã³ãã€ã«ããã«ã¯å€ãã®æ¹æ³ããããBootstrapã¯éçºè ã®è£éã«ä»»ãããŠããŸãã Bootstrapèªäœã¯Gruntã䜿çšããŠã³ã³ãã€ã«ããŸããJetBrains補åã®ãã©ã°ã€ã³ããå§ãããŸãããã®èšäºã¯åå¿è ã察象ãšããŠãããããããã·ã³ãã«ãªãœãªã¥ãŒã·ã§ã³ãç®æããŸãã ãã®ãããªãœãªã¥ãŒã·ã§ã³ã¯ã WinLess for Windowsã SimpLESS for MacããŸãã¯Koala for Linuxã§ãã ãããã®ããã°ã©ã ã¯ãã¹ãŠã»ãŒåãããšãè¡ããŸããLESSãã¡ã€ã«ãå«ããã©ã«ããŒãå ¥åãšããŠåãåãããã®å€æŽããªãã¹ã³ããŸãã ãã¡ã€ã«ãå€æŽãããšããã«ãæå®ããCSSãã¡ã€ã«ã«ããã«ã³ã³ãã€ã«ãããŸãã ãããã£ãŠãåå€æŽåŸã«æåã§ã³ã³ãã€ã«ãéå§ããå¿ èŠã¯ãããŸããã LESSãã¡ã€ã«ãå€æŽããŠä¿åããããã«ã³ã³ãã€ã«æžã¿ã®å§çž®åœ¢åŒã§ãµã€ãã®å€æŽã確èªããŸãã
ãããžã§ã¯ãäœæ
æåã®ã¹ãããã¯ããããžã§ã¯ãã®åçŽãªãã¡ã€ã«æ§é ãäœæããããšã§ãã
- ãããžã§ã¯ãã®ååïŒwhitesquare-bootstrapãªã©ïŒã§ãã©ã«ããŒãäœæããŸãã
- ãã®äžã«ããœãŒã¹ãã¡ã€ã«çšã®srcãšæçµãµã€ãã®ãã¡ã€ã«çšã®wwwãšãã2ã€ã®ãµããã©ã«ããŒãäœæããå¿ èŠããããŸãã
- wwwãã©ã«ããŒã§ã空ã®imagesãã©ã«ããŒãšç©ºã®index.htmlãã¡ã€ã«ãäœæããŸãã
- 次ã«ã BootstrapèªäœãããŠã³ããŒãã ãã¢ãŒã«ã€ãã®å 容ããããžã§ã¯ãã®wwwãã©ã«ããŒã«ã³ããŒããå¿ èŠããããŸãã
- ãããžã§ã¯ãã§LESSã䜿çšããããšã«ããã®ã§ãBootstrapãœãŒã¹ãããŠã³ããŒãããããããlessãã©ã«ããŒããããžã§ã¯ãã®srcãã©ã«ããŒã«ã³ããŒããå¿ èŠããããŸãã
- 衚瀺ãããless / bootstrapãã©ã«ããŒã®æšªã«ã2ã€ã®ç©ºã®styles.lessãã¡ã€ã«ãšvariables.lessãã¡ã€ã«ãäœæããŸãã ãã®äžã§ãBootstrapå€æ°ãäžæããã¹ã¿ã€ã«ã説æããŸãã ãã®ã¢ãããŒãã«ãããBootstrapããã°ããæŽæ°ã§ããŸãã
- 次ã«ãCSSã§LESSãã¡ã€ã«ã®ã³ã³ãã€ã«ãæ§æããå¿
èŠããããŸãã ãããWinLessã§ã©ã®ããã«è¡ãããããèŠãŠã¿ãŸãããã æåã«ãããã©ã«ããŒã®è¿œå ããã¯ãªãã¯ããŠãLESSãã¡ã€ã«ããããã©ã«ããŒãžã®ãã¹ãæå®ããŸãã
CïŒ\ whitesquare-bootstrap \ src \ less
次ã«ããã®ãã©ã«ãå ã®ãã¹ãŠã®ãã¡ã€ã«ã®ãªã¹ãã衚瀺ãããŸãã ãã¹ãŠã®ãã§ãã¯ããŒã¯ãåé€ã§ããŸãã æåŸã®2ã€ã®styles.lessãã¡ã€ã«ãšvariables.lessãã¡ã€ã«ã«èå³ããããŸãã ããããå³ã¯ãªãã¯ããŠãã³ã³ããã¹ãã¡ãã¥ãŒãã[åºåãã¡ã€ã«ã®éžæ]ãéžæããCSSãã¡ã€ã«ãã³ã³ãã€ã«ãããã¹ãæå®ããŸãã
.. \ .. \ www \ css \ styles.css
.. \ .. \ www \ css \ variables.css
ãã®åŸããããã®LESSãã¡ã€ã«ãä¿åããŠå€æŽãããšãCSSãã¡ã€ã«ãåã³ã³ãã€ã«ãããŸãã
äºåæ€æ»
ãã¡ã€ã«æ§é ãäœæããåŸãPhotoshopã§psdãã¡ã€ã«ãéããŸãã ãã³ãã¬ãŒãã泚ææ·±ã調ã¹ãŠè©äŸ¡ããããšãéèŠã§ãã 次ã®ããšãç解ããå¿ èŠããããŸãã
- ç»åã¯ã©ã®ããã«ã¹ã©ã€ã¹ãããŸããïŒ
- ã©ã®ã³ã³ããŒãã³ãã䜿çšãããŸããïŒ
- äž»ãªã¹ã¿ã€ã«ã¯äœã§ããïŒ
- ã©ã®ããŒãžã¬ã€ã¢ãŠããååŸããŸããïŒ
ãããã®è³ªåã«èªåã§ã¡ã³ã¿ã«ã«çããåŸã§ã®ã¿ãã¬ã€ã¢ãŠãã«é²ãããšãã§ããŸãã ãããã®åé¡ãé çªã«èŠãŠã¿ãŸãããã
äžè¬çãªç»å
ãã®æ®µéã§ã¯ããµã€ãã®ãã¹ãŠã®ããŒãžã«ãããã³ã³ãã³ãã«é¢é£ããªãäžè¬çãªç»åã®ã¿ãã«ããããŠä¿åããå¿ èŠããããŸãã ç§ãã¡ã®å Žåãããã¯æããç°è²ã®ããŒãžã®èæ¯ãããããŒã®èæ¯ãå°å³ç»åã2ã€ã®ããŽããœãŒã·ã£ã«ãããã¯ãŒã¯ãã¿ã³ã§ãã
å°å³ç»åãä¿åããŸãã
images / map.png
次ã®ããã«ããŽãä¿åããŸãã
images / logo.png
images / footer-logo.png
èæ¯ç»åã®ç¹°ãè¿ãã¯ãåçŽããã³æ°Žå¹³ã«ç¹°ãè¿ããŠå®å šãªç»åã圢æããã®ã«ååãªæå°ã¹ã©ã€ã¹ã§ã«ããããå¿ èŠããããŸãã
/images/bg.png
/images/h1-bg.png
åããµã€ãºã®ãœãŒã·ã£ã«ãããã¯ãŒã¯ã®ã¢ã€ã³ã³ã¯1ã€ã®ãã¡ã€ã«ã«äŸ¿å©ã«ä¿åãããããŠã³ããŒããé«éåããããã®ã¹ãã©ã€ããšããŠäœ¿çšãããŸãã ç»åã®æ¥çã®è©³çŽ°ã«ã€ããŠã¯ãæåã®éšåã§èª¬æããŸãã çµæã¯2ã€ã®ãã¡ã€ã«ã§ãã
/images/social.png
/images/social-small.png
ã³ã³ããŒãã³ã
Bootstrapã䜿çšããã¬ã€ã¢ãŠããšãã€ãã£ãã¬ã€ã¢ãŠãã®äž»ãªéãã¯ãBootstrapãã³ã³ããŒãã³ããªã©ãå°å ¥ããããšã§ãã ã³ã³ããŒãã³ãã¯ãå€ãã®å Žåãäºåå®çŸ©ãããã¹ã¿ã€ã«ãæã€æ¢è£œã®HTMLãããã¯ã§äœ¿çšãããŸãã ã³ã³ããŒãã³ãã¯æã JavaScriptã䜿çšããŸãã ã¿ã€ãã»ãã¿ãŒã¯æ¢è£œã®ã³ã³ããŒãã³ãã䜿çšãããã®å€èŠ³ã決å®ã§ããŸãã ãããè¡ãã«ã¯ãå€ãã®å ŽåãBootstrapã®å€æ°ã®å€ãå€æŽããã ãã§ãã ããæè»ãªå€æŽãå¿ èŠãªå Žåãã¬ã€ã¢ãŠãèšèšè ã¯ãå¿ èŠã«å¿ããŠHTMLãšCSSããã€ã§ãå€æŽã§ããŸãã
ãã³ãã¬ãŒããèŠããšã次ã®ã³ã³ããŒãã³ããå¿ èŠã§ããããšãããããŸãã
- åãå«ãã¬ã€ã¢ãŠãã®å Žå-ã°ãªããã·ã¹ãã ïŒè¡ãåïŒ
- æ€çŽ¢ã®å Žå-ã€ã³ã©ã€ã³ãã©ãŒã ïŒãã©ãŒã ã€ã³ã©ã€ã³ïŒãã°ã«ãŒãåãããã³ã³ãããŒã«ïŒå ¥åã°ã«ãŒãïŒããã¿ã³ïŒbtnïŒ
- ããã²ãŒã·ã§ã³-ããã²ãŒã·ã§ã³ããŒïŒnavbarïŒããã³ããã²ãŒã·ã§ã³èªäœïŒnavïŒ
- ãµãã¡ãã¥ãŒã衚瀺ããã«ã¯-ã°ã«ãŒããªã¹ãïŒãªã¹ãã°ã«ãŒãïŒ
- ã«ãŒããããã¯çš-èŠèŠããã«
- 倧ããªäžå€®ãŠãããã衚瀺ããã«ã¯-ãžã£ã³ãããã³
- ãã©ããã¬ãŒã ã衚瀺ããã«ã¯-ãµã ãã€ã«ïŒãµã ãã€ã«ïŒ
ã¬ã€ã¢ãŠãã§ã³ã³ããŒãã³ããæºããããããåã³ã³ããŒãã³ãã«ã€ããŠè©³ãã説æããŸãã
åºæ¬ã¹ã¿ã€ã«
Bootstrapã§ã¯ããã¹ãŠã®ããã©ã«ãã¹ã¿ã€ã«ãæ¢ã«èšå®ãããŠããŸãããã¶ã€ã³ãšç°ãªãå Žåã«ã®ã¿ããããã匷å¶çµäºããå¿ èŠããããŸãã ããã¯src / less / variables.cssãã¡ã€ã«ã§è¡ããŸãã
ãŸããããŒãã¹ãã©ããèšå®ã«ãªãå€æ°ãè¿œå ããŠãå°æ¥ãããã䜿çšã§ããããã«ããå¿ èŠããããŸãã ç§ãã¡ã«ãšã£ãŠãããã¯ç¹å®ã®ãã¶ã€ã³ãã©ã³ãã«ãããŸããã
@brand-font: 'Oswald',sans-serif;
ãã·ã¢ã®ãµã€ãã«ãã³ãã¬ãŒãã䜿çšããå Žåã¯ããã©ã³ãOswaldãããªã«æåããµããŒãããæãè¿ãCuprumã«çœ®ãæããŠã¿ãŠãã ããã
次ã«ãBootstrapèšå®ãèªåã®ãã®ã«çœ®ãæããŸãã
/* */ @body-bg: #f8f8f8; /* */ @ brand-primary: #29c5e6; /* */ @panel-bg: #f3f3f3; /* */ @panel-inner-border: #e7e7e7; /* */ @border-radius-base: 0; /* */ @btn-primary-bg: @brand-primary; /* 992px, 960px*/ @container-md: 960px; /* 1200px, 960px*/ @container-lg: @container-md; /* Tahoma*/ @font-family-base: Tahoma, sans-serif; /* */ @font-size-base: 12px; /* */ @text-color: #8f8f8f; /* */ @input-bg: @panel-bg; /* */ @input-border: @panel-inner-border; /* */ @input-color: #b2b2b2;
Bootstrapã«ãããã¹ãŠã®å€æ°ã¯ã httpïŒ//getbootstrap.com/customize/ã§è¡šç€ºã§ããŸãã
å€æ°ã®åŠçãå®äºããããstyles.lessãã¡ã€ã«ã«ãã¶ã€ã³ã®ã¹ã¿ã€ã«ãæžãå§ããŸãããã ãŸããBootstrapèªäœãšå€æ°ãæ¥ç¶ããŸãã
@import "bootstrap/bootstrap.less"; @import "variables.less";
Bootstrapã§å®çŸ©ãããŠãããã¹ãŠã®ããã©ã«ãã¹ã¿ã€ã«ãå€æ°ã§å€æŽã§ããããã§ã¯ãããŸãããæåã§å€æŽããŠã¿ãŸãããã
p { margin: 20px 0; } .form-control { box-shadow: none; } .btn { font-family: @brand-font; }
ããã§ã¯ããã©ãŒã èŠçŽ ãã圱ãåé€ãããã¿ã³å ã®ããã¹ãã¯ç¹å®ã®ããŒãžãã©ã³ãã瀺ããŠããŸããã
次ã«ãããŒãžã®èæ¯ãšãããããŒã«ã€ããŠèª¬æããŸãã
body { border-top: 5px solid #7e7e7e; background-image: url(../images/bg.png); }
ããã«ãããã¹ãã¯ãã©ã®ãã¡ã€ã«ã«ã¹ã¿ã€ã«ãèšè¿°ãããŠãããã瀺ããŸããã ãã¹ãŠã®å€æ°ãvariables.lessãã¡ã€ã«ã«ä¿åãããšãCSSã¹ã¿ã€ã«ã¯styles.lessã«ä¿åãããããšã«æ³šæããŠãã ããã
HTMLã¯ã€ã€ãã¬ãŒã
åŸæ¥ãHTMLãã¬ãŒã ã¯ãŒã¯ã䜿çšããŠãµã€ãã®ã¬ã€ã¢ãŠããéå§ããŸããã éå§ããŒãžã®æãåçŽãªãã³ãã¬ãŒãã®ã³ãŒããindex.htmlãã¡ã€ã«ã«è²Œãä»ããŸãã以åã«äžèŠãªãã®ããã¹ãŠåé€ããŸããã
<!DOCTYPE html> <html> <head> <title>Whitesquare</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="css/styles.css" rel="stylesheet"> <!--[if lt IE 9]> <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script> <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script> <![endif]--> </head> <body> </body> </html>
ãã®ãããã¯ã¯ãããã¥ã¡ã³ãã®HTML5æ§é ãäœæããŸãã ã¿ã€ãã«ã§ã¯ãããŒãžã®åå-Whitesquareã瀺ããŠããŸãã ãã¥ãŒããŒãã¡ã¿ã¿ã°ã¯ãã¢ãã€ã«ããã€ã¹ã®ããŒãžå¹ ãç»é¢ã®å¹ ã«çãããªããåæã¹ã±ãŒã«ã100ïŒ ã«ãªãããšã瀺ããŸãã 次ã«ãã¹ã¿ã€ã«ã·ãŒããæ¥ç¶ãããŸãã ãŸãã9çªç®ãããåã®ããŒãžã§ã³ã®Internet Explorerã§ã¯ãã¬ã€ã¢ãŠããæ£ãã衚瀺ã§ããã¹ã¯ãªãããæ¥ç¶ããŸãã
ã¬ã€ã¢ãŠã
ãã®å Žåããµã€ãã¯2ã€ã®éšåã§æ§æãããŠããããšãããããŸããç»é¢ã®äžå€®ã«ããã³ã³ãã³ããå«ãã¡ã€ã³ã³ã³ãããŒãšã¹ãã¬ããããã¿ãŒã§ãã ã¡ã€ã³ã³ã³ããã¯ãã¡ã€ã³ã³ã³ãã³ããšãµã€ãããŒã®2ã€ã®åã§æ§æãããŸãã ãããã®äžã«ã¯ãããããŒïŒããããŒïŒãããã²ãŒã·ã§ã³ïŒnavïŒãããã³ããŒãžåïŒ.headingïŒããããŸãã
bodyã«æ¬¡ã®ã³ãŒããè¿œå ããŸãããã
<body> <div class="wrapper container"> <header></header> <nav></nav> <div class="heading"></div> <div class="row"> <aside class="col-md-7"></aside> <section class="col-md-17"></section> </div> </div> <footer></footer>
ããã§ãBootstrapã®æåã®ã³ã³ããŒãã³ãã§ããåã«åºäŒããŸã ã åã®èŠªã¯ã©ã¹ã¯è¡ã¯ã©ã¹ã«èšå®ãããåã¯ã©ã¹ã¯col-ãã¬ãã£ãã¯ã¹ã§å§ãŸãã次ã«ç»é¢ãµã€ãºïŒxsãsmãmdãlgïŒã§å§ãŸããåã®çžå¯Ÿçãªå¹ ã§çµãããŸãã
åã¯ãããšãã°class = "col-xs-12 col-md-8"ã®ããã«ãç»é¢ã®å€ãæã€ç°ãªãã¯ã©ã¹ãåæã«èšå®ã§ããŸãã ãããã®ã¯ã©ã¹ã¯ãç¹å®ã®ç»é¢ãµã€ãºã®ããŒã»ã³ããŒãžãšããŠåå¹ ãèšå®ããã ãã§ãã ç¹å®ã®ç»é¢ã®ã¯ã©ã¹ãåã«æå®ãããŠããªãå Žåãå®çŸ©ãããæå°ç»é¢ã®ã¯ã©ã¹ãé©çšãããæå®ãããŠããªãå Žåãå¹ ã¯é©çšãããããããã¯ã¯æ倧å¯èœå¹ ãå æããŸãã
col-md-7ããã³col-md-17ã¯ã©ã¹ã¯ããããã¯ã芪ã³ã³ãããŒã«çžå¯Ÿçãªå¹ 7ããã³17ã®åã§ããããšã瀺ããŠããŸãã ããã©ã«ãã§ã¯ãBootstrapã®åå¹ ã®åèšã¯12ã§ãããå¿ èŠãªæè»æ§ãå®çŸããããã«ãã®æ°ã2åã«ããŸããã
@grid-columns: 24;
次ã«ãå¿ èŠãªã€ã³ãã³ãã«ã€ããŠèª¬æããŸãã
body { ⊠.wrapper { padding: 0 0 50px 0; } header { padding: 20px 0; } }
ãã®ãã¶ã€ã³ãäœå ã«é 眮ããŸããã LESSæ§æã䜿çšãããšãã«ãŒã«ãçžäºã«ãã¹ãã§ããŸãããããã®ã«ãŒã«ã¯ã次ã®ãããªæ§æã«ã³ã³ãã€ã«ãããŸãã
body .wrapper {âŠ} body header {âŠ}
ãã®ã¢ãããŒãã«ãããCSSå ã§HTMLæ§é ãçŽæ¥èŠãããšãã§ããã«ãŒã«ã«ããçš®ã®ãã¹ã³ãŒãããäžããããŸãã
ããŽ
ããŽãããããŒã¿ã°ã«æ¿å ¥ããŸãã
<header> <a href="/"><img src="" alt="Whitesquare logo"></a> </header>
è¿œå ã®ã¹ã¿ã€ã«ã¯å¿ èŠãããŸããã
æ€çŽ¢ãã
æ€çŽ¢ãäœæããã«ã¯ã ã€ã³ã©ã€ã³ãã©ãŒã ã ã°ã«ãŒãåãããã³ã³ãããŒã« ã ãã¿ã³ã® Bootstrapã³ã³ããŒãã³ããå¿ èŠã§ãã
ããããŒã¿ã°ã§ãå³æãã®ã€ã³ã©ã€ã³ã·ã§ã€ããäœæããŸãã ãã®ãã©ãŒã ã®ãã£ãŒã«ãã«ã¯ãã¯ã©ã¹ãform-controlããšã©ãã«ãå¿ èŠã§ãã
ãã©ãŒã ã§ã¯ãã³ã³ããŒãã³ãããã°ã«ãŒãåãããã³ã³ãããŒã«ãã«é 眮ããŸãã ã³ã³ãããŒã«ãã°ã«ãŒãåãããšãããã¹ãå ¥åãšãã¿ã³ã®éã®ã€ã³ãã³ããåé€ããããããåäžã®èŠçŽ ã«ããŒãžããæ¹æ³ãåé€ã§ããŸãã
å ¥åã°ã«ãŒãã¯ã©ã¹ãšãã£ãŒã«ããæã€divã§ããããã®ãããªã³ã³ããŒãã³ãã®ãã¿ã³ã¯input-group-btnã¯ã©ã¹ãæã€ãããã¯ã«é 眮ãããŸãã
æ€çŽ¢ãã£ãŒã«ãã®ã©ãã«ã衚瀺ããå¿ èŠããªããããsrã®ã¿ã®ã¯ã©ã¹ã§ã©ãã«ãé衚瀺ã«ããŸãã ããã¯ç¹å¥ãªã¹ã¯ãªãŒã³ãªãŒããŒçšã§ãã
ãbtn-primaryãã¯ã©ã¹ããã¿ã³ã«è¿œå ãããŸããããã¯ãããããã®ãã©ãŒã ã®ãã©ã€ããªãã¿ã³ã§ããããšãæå³ããŸãã
<header> ⊠<form name="search" action="#" method="get" class="form-inline form-search pull-right"> <div class="input-group"> <label class="sr-only" for="searchInput">Search</label> <input class="form-control" id="searchInput" type="text" name="search" placeholder="Search"> <div class="input-group-btn"> <button type="submit" class="btn btn-primary">GO</button> </div> </div> </form> </header>
ããšã¯ãæ€çŽ¢ãã©ãŒã ã®å¹ ãã¹ã¿ã€ã«ã§èšå®ããã ãã§ãã
body { ⊠.wrapper { ⊠header { ⊠.form-search { width: 200px; } } } }
ã¡ãã¥ãŒ
ã¡ãã¥ãŒã衚瀺ããã«ã¯ãã ããã²ãŒã·ã§ã³ããã« ãã³ã³ããŒãã³ãã䜿çšãããã®äžã«ã ããã²ãŒã·ã§ã³ ãã³ã³ããŒãã³ããé 眮ããŸããããã¯ãªã³ã¯ä»ãã®ãªã¹ãã§ãã ããã²ãŒã·ã§ã³ã®ããã«ããnavbar-navãã¯ã©ã¹ãè¿œå ãããããã²ãŒã·ã§ã³ããã«å ã®ç¹å¥ãªããã²ãŒã·ã§ã³ã¹ã¿ã€ã«ãé©çšãããŸãã
<nav class="navbar navbar-default"> <ul class="nav navbar-nav"> <li><a href="/home/">Home</a></li> <li class="active"><a href="/about/">About us</a></li> <li><a href="/services/">Services</a></li> <li><a href="/partners/">Partners</a></li> <li><a href="/customers/">Customers</a></li> <li><a href="/projects/">Projects</a></li> <li><a href="/careers/">Careers</a></li> <li><a href="/contact/">Contact</a></li> </ul> </nav>
ãã®ã¡ãã¥ãŒãèšèšã«åãå ¥ããããã«ãå€æ°ã«æ¬¡ã®å€ãèšå®ããŸãã
/* */ @navbar-height: 37px; /* */ @nav-link-padding: 10px 30px; /* */ @navbar-default-bg: @panel-bg; /* */ @navbar-default-link-color: #b2b2b2; /* â */ @navbar-default-link-hover-color: @navbar-default-link-color; /* â */ @navbar-default-link-active-bg: @brand-primary; /* */ @navbar-default-link-active-color: #fff;
ã«ã¹ã¿ã ãã©ã¡ãŒã¿ã«å ããŠãè¿œå ã®ã¹ã¿ã€ã«ã説æããŸããããã¯å€§æåã®ããã¹ãã§ãããç¹å®ã®ãã©ã³ãã§ãã
body { ⊠.wrapper { ⊠.navbar a { text-transform: uppercase; font: 14px @brand-font; } } }
ããŒãžã¿ã€ãã«
ããŒãžã¿ã€ãã«ã¯ãèŠåºãã¯ã©ã¹ãæã€divã«é 眮ãããŸãã
<div class="heading"> <h1>About us</h1> </div>
ãŸãã次ã®ã¹ã¿ã€ã«ããããŸãã
body { ⊠.wrapper { ⊠.heading { height: 40px; background: transparent url(../images/h1-bg.png); margin: 30px 0; padding-left: 20px; h1 { display: inline-block; color: #7e7e7e; font: normal 40px/40px 'Oswald', sans-serif; background: url(../images/bg.png); margin: 0; padding: 0 10px; text-transform: uppercase; } } } }
ããã§ã¯ãèæ¯ã«divã®ã°ã¬ãŒã®ããŒãæç»ããh1ã«éæãªèæ¯ã®å°è±¡ãäžããããã«ãç®çã®ãã©ã³ããšããŒãžã®èæ¯è²ã§ã€ã³ã©ã€ã³h1ãé 眮ããŸãã
ãµãã¡ãã¥ãŒ
ãµãã¡ãã¥ãŒãäœæãããšãããããã²ãŒã·ã§ã³ãã³ã³ããŒãã³ãã¯äœ¿çšããŸãããããã¯ãã¹ã¿ã€ã«ã«ãã£ãŠããŸãé©ããŠããªããããã ã°ã«ãŒããªã¹ã ãã³ã³ããŒãã³ãã®æ¹ãã¯ããã«é©ããŠããããã§ãã ãã®ãããªã³ã³ããŒãã³ãã®åèŠçŽ ã«ã¯ãã¯ã©ã¹ãlist-group-itemãããããŸãã
ãµãã¡ãã¥ãŒã¯ãasideã¿ã°ã«é 眮ããå¿ èŠããããŸãã ã¡ã€ã³ã¡ãã¥ãŒãšåãæ¹æ³ã§ãªã³ã¯ã®ãªã¹ããäœæããŸãã
<aside class="col-md-7"> <ul class="list-group submenu"> <li class="list-group-item active">Lorem ipsum</li> <li class="list-group-item"><a href="/donec/">Donec tincidunt laoreet</a></li> <li class="list-group-item"><a href="/vestibulum/">Vestibulum elit</a></li> <li class="list-group-item"><a href="/etiam/">Etiam pharetra</a></li> <li class="list-group-item"><a href="/phasellus/">Phasellus placerat</a></li> <li class="list-group-item"><a href="/cras/">Cras et nisi vitae odio</a></li> </ul> </aside>
ã³ã³ããŒãã³ãã®èšå®ã§ã¯ããã¹ãŠã®ã°ã«ãŒãåããããªã¹ããããã«ã³ã³ããŒãã³ãã®èæ¯ãšãã¬ãŒã ãšãšãã«è¡šç€ºãããããšã瀺ããŠããŸãã
@list-group-bg: @panel-bg; @list-group-border: @panel-inner-border;
ãããŠããµãã¡ãã¥ãŒã«æ¬¡ã®ã¹ã¿ã€ã«ãé©çšããŸãã
body { ⊠.wrapper { ⊠.submenu { margin-bottom: 30px; li { display: list-item; font: 300 14px @brand-font; list-style-position: inside; list-style-type: square; padding: 10px; text-transform: uppercase; &.active { color: @brand-primary; } a { color: @text-color; text-decoration: none; &:hover { color: @text-color; } } } } } }
ãŸããBootstrapãç¬èªã®ã¹ã¿ã€ã«ãäžæããããããªã¹ãã®èŠçŽ ã«æšæºã¹ã¿ã€ã«ãè¿ããŸãã äžã«ã€ã³ãã³ããè¿œå ããŸãã ãµãã¡ãã¥ãŒã§ã¯ã现ããã©ã³ããšæ£æ¹åœ¢ã®ããŒã«ãŒã䜿çšãããŸãã ãããŠããªã³ã¯ã«ã€ããŠã¯ãè²ã倧æåãèšå®ããäžç·ãåé€ããŸãã LESSæ§æã«ãããïŒ.activeãã³ãŒãå ã®ã¢ã³ããµã³ãã¯ãã³ã³ãã€ã«æã«èŠªã»ã¬ã¯ã¿ãŒã.submenu li.activeãã«çœ®ãæããããŸãã
ãµã€ãããŒã®ã³ã³ãã³ã
ãµã€ãããŒã®ã³ã³ãã³ãã«ã¯ããµãã¡ãã¥ãŒã«å ããŠããªãã£ã¹ã®å Žæã瀺ãç»åããããŸãã
ããã衚瀺ããã«ã¯ãã panel ãã³ã³ããŒãã³ããé©ããŠããŸããããããã¿ã€ãã«ãçè²ããããã®ãã¡ã€ã³ããã«ãïŒpanel-primaryïŒã®ããªãšãŒã·ã§ã³ã§ãã ãã®ã³ã³ããŒãã³ãã«ã¯ãããããŒãããã¯ïŒããã«èŠåºãïŒãšãããã¯ã³ã³ãã³ããããã¯ïŒããã«æ¬äœïŒãå«ãŸããŠããŸãã ãimg-responsiveãã¯ã©ã¹ããããç»åã«è¿œå ããŸããããã«ãããç»åãå°ããªç»é¢å¹ ã§çž®å°ã§ããŸãã
<aside class="col-md-7"> ⊠<div class="panel panel-primary"> <div class="panel-heading">Our offices</div> <div class="panel-body"> <img src="/images/map.png" class="img-responsive" alt="Our offices"> </div> </div> </aside>
Bootstrapå€æ°ã§ã¯ãããã«ã®èæ¯ïŒpanel-bgïŒã®è²ãæ¢ã«èšå®ããŠãããããã©ã«ãã§èšå®ãããŠããããã«ãããã©ã€ããªãããã«ã«ã¯ããã©ã«ãã®ããã«ã«éã§ã¯ãªãç°è²ã®å¢çç·ãããããšã瀺ããŸãã
@panel-primary-border: @panel-inner-border;
ããã§ããµã€ãã®ã¹ã¿ã€ã«ã§ãããã«ã®ããã©ã«ãèšå®ãå€æŽããå¿ èŠããããŸãããå€æ°ãä»ããŠã¯å€æŽãããŸããã
.panel { box-shadow: none; .panel-heading { font: 14px @brand-font; text-transform: uppercase; padding: 10px; } .panel-body { padding: 10px; } }
ããã§ã¯ãããã«ãã圱ãåé€ããããŒãžã³ãèšå®ããã¿ã€ãã«ãã©ã³ããèšå®ããŸããã
åŒçš
åŒçšãè¿œå ããŠãã³ã³ãã³ãã®ã¬ã€ã¢ãŠããéå§ããŸãã
ãã®ããŒãžèŠçŽ ã¯ã Jumbotronã³ã³ããŒãã³ãã«æã䌌ãŠããŸãã ã³ã³ãã³ãåã«è¿œå ããŸãã
<section class="col-md-17"> <div class="jumbotron"> <blockquote> <p> âQuisque in enim velit, at dignissim est. nulla ul corper, dolor ac pellentesque placerat, justo tellus gravida erat, vel porttitor libero erat.â </p> <small>John Doe, Lorem Ipsum</small> </blockquote> </div> </section>
ãžã£ã³ãããã³ã³ã³ããŒãã³ãã®å€æ°ã䜿çšããŠãããã¹ãã®çœè²ãšãã©ã³ããã«ãŒã®èæ¯ãèšå®ããŸãã
@jumbotron-bg: @brand-primary; @jumbotron-color: #fff;
ãããŠç§ãã¡ã®ã¹ã¿ã€ã«ã説æããŠãã ããïŒ
body { ⊠.wrapper { ⊠.jumbotron { border-radius: 0; padding: 0; margin: 0; blockquote { border-left: none; p { font: 300 italic 33px @brand-font; text-transform: uppercase; margin-bottom: 0; } small { text-align: right; color: #1D8EA6; font: 300 20px @brand-font; &:before { content: ''; } } } } } }
ãããã§ã¯ãè§ã®äžžã¿ãã³ã³ããŒãã³ãã®ã€ã³ãã³ããããã³ããã©ã«ãã§Bootstrapã«ãã£ãŠèšå®ãããåŒçšè£ 食ãåé€ããŸãã ãŸãããã©ã³ãã«ã¹ã¿ã€ã«ãè¿œå ããŸãã
å 容
ããã¹ãã³ã³ãã³ãã®ãã¹ãŠã®ã¹ã¿ã€ã«ãæ¢ã«è¿œå ãããŠããŸãã ãããã£ãŠãããã¹ãèªäœãå«ã3ã€ã®æ®µèœã®ã¿ãè¿œå ããããšã«ãªããŸãã
<p>Lorem ipsum dolor sit ametâŠ</p> <p>Donec vel nisl nibhâŠ</p> <p>Donec vel nisl nibhâŠ</p>
次ã®ã¹ãããã¯ãã³ã³ãã³ãããã¹ãã®æåŸã«ãã2ã€ã®ç»åãè¿œå ããããšã§ãã ããã¯ã2ã€ã®åã䜿çšããŠè¡ãããŸãã
<div class="row"> <div class="col-md-12"> <img src="/images/about-1.png" alt="" class="thumbnail"> </div> <div class="col-md-12"> <img src="/images/about-2.png" alt="" class="thumbnail"> </div> </div>
ãµã ãã€ã«ã¯ã©ã¹ã¯ãç»åããµã ãã€ã«ã³ã³ããŒãã³ãã«å€æããŸãã 圌ã¯ç§ãã¡ã®ããã«ç»åã®ã¹ã¿ã€ãªã³ã°ã«é¢ãããã¹ãŠã®äœæ¥ãè¡ããŸãã æ®ã£ãŠããã®ã¯ããã®ã³ã³ããŒãã³ãã®å€æ°ã«ã€ã³ãã³ããšå¢çç·ã®è²ãèšå®ããããšã ãã§ãïŒ
@thumbnail-padding: 1px; @thumbnail-border: #c9c9c9;
ãç§ãã¡ã®ããŒã ãããããã¯
ãã®ãããã¯ã®ã¬ã€ã¢ãŠãã§ã¯ãæåã«ããããŒãè¿œå ããŸãã
<h2>Our team</h2>
ã¹ã¿ã€ã«ä»ãïŒ
body { ⊠.wrapper { ⊠h2 { background: none repeat scroll 0 0 #29C5E6; color: #fff; font: 300 30px @brand-font; padding: 0 10px; text-transform: uppercase; } } }
ãããŠãåŸæ¥å¡ã®ã«ãŒããå«ã2è¡ã§æ§æããããããŒã ãã¯ã©ã¹ã®ãããã¯ãè¿œå ããŸãã åã«ãŒãã¯åã§ãã ã«ãŒãã®å¹ ã¯ãã°ãªããã®4åã«çžåœããŸãã è¡ã®æåãé€ããã¹ãŠã®ã«ãŒãã¯ãã¯ã©ã¹ãcol-md-offset-1ãã«ãã£ãŠäœæãããå·ŠåŽã«ã€ã³ãã³ããããŸãã ã«ãŒãã®å 容ã¯ç»åãšèª¬æã§æ§æãããŠããŸãïŒ.captionïŒ
<div class="team"> <div class="row"> <div class="col col-md-4"> <img src="/images/team/Doe.jpg" alt="John Doe" class="thumbnail"> <div class="caption"> <h3>John Doe</h3> <p>ceo</p> </div> </div> <div class="col col-md-4 col-md-offset-1"> <img src="/images/team/Pittsley.jpg" alt="Saundra Pittsley" class="thumbnail"> <div class="caption"> <h3>Saundra Pittsley</h3> <p>team leader</p> </div> </div> ⊠</div> <div class="row"> <div class="col col-md-4"> <img src="/images/team/Nobriga.jpg" alt="Ericka Nobriga" class="thumbnail"> <div class="caption"> <h3>Ericka Nobriga</h3> <p>art director</p> </div> </div> <div class="col col-md-4 col-md-offset-1"> <img src="/images/team/Rousselle.jpg" alt="Cody Rousselle" class="thumbnail"> <div class="caption"> <h3>Cody Rousselle</h3> <p>senior ui designer</p> </div> </div> ⊠</div> </div>
ããŒã¯ã¢ãããäœæãããããããã®èŠçŽ ã«æ¬¡ã®ã¹ã¿ã€ã«ãèšå®ããŸãã
body { ⊠.wrapper { ⊠.team { .row { margin-top: 20px; .col { white-space: nowrap; .thumbnail { margin-bottom: 5px; } } .col-md-offset-1 { margin-left: 3.7%; } .caption { h3 { font: 300 16px @brand-font; margin: 0; } p { font: 300 14px @brand-font; color: @brand-primary; margin: 0; } } } } } }
ããã§èšå®ãããŠããã€ã³ãã³ããšãã©ã³ãã¹ã¿ã€ã«ã«å ããŠãcol-md-offset-1ã¯ã©ã¹ãå€æŽããŸããã 圌ã¯3.7ïŒ ã®ã€ã³ãã³ããèšå®ããå¿ èŠããããŸããã .
: , , .
:
<footer> <div class="container"> <div class="row"> <div class="col-md-8 twitter"></div> <div class="col-md-4 sitemap"></div> <div class="col-md-6 social"></div> <div class="col-md-6 footer-logo"></div> </div> </div> </footer>
:
footer { background: #7e7e7e; color: #dbdbdb; font-size: 11px; .container { height: 110px; padding: 10px 0; } }
footer , . .
:
<div class="col-md-8 twitter"> <h3>Twitter feed</h3> <time datetime="2012-10-23"><a href="#">23 oct</a></time> <p> In ultricies pellentesque massa a porta. Aliquam ipsum enim, hendrerit ut porta nec, ullamcorper et nulla. In eget mi dui, sit amet scelerisque nunc. Aenean aug </p> </div>
:
body { ⊠footer { ⊠.container { ⊠h3 { border-bottom: 1px solid #919191; color: #ffffff; font-size: 14px; line-height: 21px; font-family: @brand-font; margin: 0 0 10px; text-transform: uppercase; } p { margin: 5px 0; } .twitter { p { padding-right: 15px; } time a { color: #b4aeae; text-decoration: underline; } } } } }
, . . , , .
ãµã€ãããã
:
<div class="col-md-4 sitemap"> <h3>Sitemap</h3> <div class="row"> <div class="col-md-12"> <a href="/home/">Home</a> <a href="/about/">About</a> <a href="/services/">Services</a> </div> <div class="col-md-12"> <a href="/partners/">Partners</a> <a href="/customers/">Support</a> <a href="/contact/">Contact</a> </div> </div> </div>
, .
body { ⊠footer { ⊠.container { ⊠a { color: #dbdbdb; } .sitemap a { display: block; font-size: 12px; margin-bottom: 5px; } } } }
«social».
<div class="col-md-4 social"> <h3>Social networks</h3> <a href="http://twitter.com/" class="social-icon twitter"></a> <a href="http://facebook.com/" class="social-icon facebook"></a> <a href="http://plus.google.com/" class="social-icon google-plus"></a> <a href="http://vimeo.com/" class="social-icon-small vimeo"></a> <a href="http://youtube.com/" class="social-icon-small youtube"></a> <a href="http://flickr.com/" class="social-icon-small flickr"></a> <a href="http://instagram.com/" class="social-icon-small instagram"></a> <a href="/rss/" class="social-icon-small rss"></a> </div>
:
body { ⊠footer { ⊠.container { ⊠.social { .social-icon { width: 30px; height: 30px; background: url(../images/social.png) no-repeat; display: inline-block; margin-right: 10px; } .social-icon-small { width: 16px; height: 16px; background: url(../images/social-small.png) no-repeat; display: inline-block; margin: 5px 6px 0 0; } .twitter { background-position: 0 0; } .facebook { background-position: -30px 0; } .google-plus { background-position: -60px 0; } .vimeo { background-position: 0 0; } .youtube { background-position: -16px 0; } .flickr { background-position: -32px 0; } .instagram { background-position: -48px 0; } .rss { background-position: -64px 0; } } } } }
â . (.social-icon) (.social-icon-small). . CSS , .
èäœæš©
â .
<div class="col-md-8 footer-logo"> <a href="/"><img src="" alt="Whitesquare logo"></a> <p> Copyright © 2012 Whitesquare. A <a href="http://pcklab.com">pcklab</a> creation </p> </div>
, :
body { ⊠.footer { ⊠.container { ⊠.footer-logo { float: right; margin-top: 20px; font-size: 10px; text-align: right; a { text-decoration: underline; } } } } }
. .