SlideShare a Scribd company logo
1 of 21
CSS Layout – Steps



               http://flic.kr/p/9P5DTb
CSS Layout – Steps
1. Consider each element!
  Which box belongs where? Create a declaration for each element.
News    Static   Login




#news   #info    #login
CSS Layout – Steps
1. Consider each element!
  Which box belongs where? Create a declaration for each element.
2. Think of the widths!
  Do design rules like the golden ratio or a grid play a role?
The Golden Ratio




        goldenratiocalculator.com
Grid Based Designs   http://grid-based.com/
CSS Layout – Steps
1. Consider each element!
  Which box belongs where? Create a declaration for each element.
2. Think of the widths!
  Do design rules like the golden ratio or a grid play a role?
3. Calculate the values!
  Sorry, you need to do some maths here…
28% + 2% + 50% + 2% + 18% = 100%

220px + 20px + 480px + 20px + 220px = 960px




         It needs to add up
         or your layout will break!
CSS Layout – Steps
1. Consider each element!
  Which box belongs where? Create a declaration for each element.
2. Think of the widths!
  Do design rules like the golden ratio or a grid play a role?
3. Calculate the values!
  Sorry, you need to do some maths here…
4. Apply the values in the CSS!
  Try to be as concise as possible!
#red {
         background-color: red;
         width: 18%;
         height: 400px;
         margin: 0 2% 0 0;
}
#green {
        background-color: green;
        width: 50%;
        height: 400px;
        margin: 0 2% 0 0;
}
#blue {
        background-color: blue;
        width: 28%;
        height: 400px;
        margin: 0;
}
CSS Layout – Steps
1. Consider each element!
  Which box belongs where? Create a declaration for each element.
2. Think of the widths!
  Do design rules like the golden ratio or a grid play a role?
3. Calculate the values!
  Sorry, you need to do some maths here…
4. Apply the values in the CSS!
  Try to be as concise as possible!
5. Choose the method of layout!
  Is it going to be float or position?
VS
http://flic.kr/p/56L7gN                          http://flic.kr/p/aeLWkc


    • text related images        • elements in a
    • varying heights in           concreted position
      column layout              • need to overwrite
      ( less hassle)              document flow
    • listing things             • flexible
      (document flow             • need to overlap
      matters)
VS
http://flic.kr/p/56L7gN                          http://flic.kr/p/aeLWkc




    Rule
    If elements should not interact, use absolute
    positioning, if they should, use floats.
                                       —says Kilian Valkhof
                                         kilianvalkhof.com
CSS Layout – Steps
1. Consider each element!
  Which box belongs where? Create a declaration for each element.
2. Think of the widths!
  Do design rules like the golden ratio or a grid play a role?
3. Calculate the values!
  Sorry, you need to do some maths here…
4. Apply the values in the CSS!
  Try to be a concise as possible!
5. Choose the method of layout!
  Is it going to be float or position?
6. Apply the method in the CSS!
  Know where to put things!
#red {                                #red {
           background-color: red;                background-color: red;
           width: 18%;                           width: 18%;
                                                 height: 400px;
           height: 400px;
                                                 position: absolute;
           margin: 0 2% 0 0;
                                                 top: 0;
           float: left;                          left: 0;
}                                     }
#green {                              #green {
           background-color: green;              background-color: green;
           width: 50%;                           width: 50%;
           height: 400px;                        height: 400px;
           margin: 0 2% 0 0;                     position: absolute;
                                                 top: 0;
           float: left;
                                                 left: 20%;
}
                                      }
#blue {                               #blue {
           background-color: blue;               background-color: blue;
           width: 28%;                           width: 28%;
           height: 400px;                        height: 400px;
           margin: 0;                            position: absolute;
           float: left;                          top: 0;
}                                                left: 72%;
                                      }
CSS Layout – Steps
1. Consider each element!
  Which box belongs where? Create a declaration for each element.
2. Think of the widths!
  Do design rules like the golden ratio or a grid play a role?
3. Calculate the values!
  Sorry, you need to do some maths here…
4. Apply the values in the CSS!
  Try to be as concise as possible!
5. Choose the method of layout!
  Is it going to be float or position?
6. Apply the method in the CSS!
  Know where to put things!
7. Rewrite the CSS with combined selectors
   and shorthand notation!
#red {
           background-color: red;
           width: 18%;
           height: 400px;
           margin: 0 2% 0 0;
           float: left;
}
#green {
           background-color: green;
           width: 50%;
           height: 400px;
           margin: 0 2% 0 0;
           float: left;
}
#blue {
           background-color: blue;
           width: 28%;
           height: 400px;
           margin: 0;
           float: left;
}
#red {                         #red {
                                          background-color: red;
                                          width: 18%;
           height: 400px;
           margin: 0 2% 0 0;
           float: left;
}                              }
#green {                       #green {
                                          background-color: green;
                                          width: 50%;
           height: 400px;
           margin: 0 2% 0 0;
           float: left;
}                              }
#blue {                        #blue {
                                          background-color: blue;
                                          width: 28%;
           height: 400px;
           margin: 0;
           float: left;
}                              }
#red, #green, #blue {        #red {
         height: 400px;                 background-color: red;
         float: left;                   width: 18%;
}
#red, #green {
         margin: 0 2% 0 0;
}                            }
#blue {                      #green {
         margin: 0;                     background-color: green;
}                                       width: 50%;



                             }
                             #blue {
                                        background-color: blue;
                                        width: 28%;



                             }
#red, #green, #blue {
         height: 400px;
         float: left;
}
#red, #green {
         margin: 0 2% 0 0;
}
#red {
         background-color: red;
         width: 18%;
}
#green {
         background-color: green;
         width: 50%;
}
#blue {
         background-color: blue;
         width: 28%;
         margin: 0;
}
CSS Layout – Steps
1. Consider each element!
  Which box belongs where? Create a declaration for each element.
2. Think of the widths!
  Do design rules like the golden ratio or a grid play a role?
3. Calculate the values!
  Sorry, you need to do some maths here…
4. Apply the values in the CSS!
  Try to be as concise as possible!
5. Choose the method of layout!
  Is it going to be float or position?
6. Apply the method in the CSS!
  Know where to put things!
7. Rewrite the CSS with combined selectors
   and shorthand notation!

More Related Content

More from Alexander Sperl

E-Learning in der wissenschaftlichen Weiterbildung
E-Learning in der wissenschaftlichen WeiterbildungE-Learning in der wissenschaftlichen Weiterbildung
E-Learning in der wissenschaftlichen WeiterbildungAlexander Sperl
 
Das ICM als Modell für die praxisnahe Ausbildung im Lehramt
Das ICM als Modell für die praxisnahe Ausbildung im LehramtDas ICM als Modell für die praxisnahe Ausbildung im Lehramt
Das ICM als Modell für die praxisnahe Ausbildung im LehramtAlexander Sperl
 
Vortrag WS 7, Arbeitstagung Weimar
Vortrag WS 7, Arbeitstagung WeimarVortrag WS 7, Arbeitstagung Weimar
Vortrag WS 7, Arbeitstagung WeimarAlexander Sperl
 
Präsentation M.Sc. Kinderzahnheilkunde
Präsentation M.Sc. KinderzahnheilkundePräsentation M.Sc. Kinderzahnheilkunde
Präsentation M.Sc. KinderzahnheilkundeAlexander Sperl
 
Präsentation AG E-Learning, Fachforum JLU 2014
Präsentation AG E-Learning, Fachforum JLU 2014Präsentation AG E-Learning, Fachforum JLU 2014
Präsentation AG E-Learning, Fachforum JLU 2014Alexander Sperl
 
E-Learning-Unterstützung im WM³-Projekt
E-Learning-Unterstützung im WM³-ProjektE-Learning-Unterstützung im WM³-Projekt
E-Learning-Unterstützung im WM³-ProjektAlexander Sperl
 
Präsentation AG E-Learning, Projektgesamttreffen
Präsentation AG E-Learning, ProjektgesamttreffenPräsentation AG E-Learning, Projektgesamttreffen
Präsentation AG E-Learning, ProjektgesamttreffenAlexander Sperl
 
Struktur, Layout und Design
Struktur, Layout und DesignStruktur, Layout und Design
Struktur, Layout und DesignAlexander Sperl
 
Wissensvermittlung in allen drei Phasen der Lehrerbildung
Wissensvermittlung in allen drei Phasen der LehrerbildungWissensvermittlung in allen drei Phasen der Lehrerbildung
Wissensvermittlung in allen drei Phasen der LehrerbildungAlexander Sperl
 

More from Alexander Sperl (15)

Videos in der Lehre
Videos in der LehreVideos in der Lehre
Videos in der Lehre
 
E-Learning in der wissenschaftlichen Weiterbildung
E-Learning in der wissenschaftlichen WeiterbildungE-Learning in der wissenschaftlichen Weiterbildung
E-Learning in der wissenschaftlichen Weiterbildung
 
Das ICM als Modell für die praxisnahe Ausbildung im Lehramt
Das ICM als Modell für die praxisnahe Ausbildung im LehramtDas ICM als Modell für die praxisnahe Ausbildung im Lehramt
Das ICM als Modell für die praxisnahe Ausbildung im Lehramt
 
Vortrag WS 7, Arbeitstagung Weimar
Vortrag WS 7, Arbeitstagung WeimarVortrag WS 7, Arbeitstagung Weimar
Vortrag WS 7, Arbeitstagung Weimar
 
Präsentation M.Sc. Kinderzahnheilkunde
Präsentation M.Sc. KinderzahnheilkundePräsentation M.Sc. Kinderzahnheilkunde
Präsentation M.Sc. Kinderzahnheilkunde
 
Präsentation AG E-Learning, Fachforum JLU 2014
Präsentation AG E-Learning, Fachforum JLU 2014Präsentation AG E-Learning, Fachforum JLU 2014
Präsentation AG E-Learning, Fachforum JLU 2014
 
E-Learning-Unterstützung im WM³-Projekt
E-Learning-Unterstützung im WM³-ProjektE-Learning-Unterstützung im WM³-Projekt
E-Learning-Unterstützung im WM³-Projekt
 
Präsentation AG E-Learning, Projektgesamttreffen
Präsentation AG E-Learning, ProjektgesamttreffenPräsentation AG E-Learning, Projektgesamttreffen
Präsentation AG E-Learning, Projektgesamttreffen
 
Layout
LayoutLayout
Layout
 
Analysing Prototypes
Analysing PrototypesAnalysing Prototypes
Analysing Prototypes
 
Struktur, Layout und Design
Struktur, Layout und DesignStruktur, Layout und Design
Struktur, Layout und Design
 
Wissensvermittlung in allen drei Phasen der Lehrerbildung
Wissensvermittlung in allen drei Phasen der LehrerbildungWissensvermittlung in allen drei Phasen der Lehrerbildung
Wissensvermittlung in allen drei Phasen der Lehrerbildung
 
Lernplattformen
LernplattformenLernplattformen
Lernplattformen
 
Color
ColorColor
Color
 
Aspects of good design
Aspects of good designAspects of good design
Aspects of good design
 

Recently uploaded

(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一Fi sss
 
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书zdzoqco
 
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degreeyuu sss
 
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree 毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree ttt fff
 
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024CristobalHeraud
 
Design principles on typography in design
Design principles on typography in designDesign principles on typography in design
Design principles on typography in designnooreen17
 
办理(USYD毕业证书)澳洲悉尼大学毕业证成绩单原版一比一
办理(USYD毕业证书)澳洲悉尼大学毕业证成绩单原版一比一办理(USYD毕业证书)澳洲悉尼大学毕业证成绩单原版一比一
办理(USYD毕业证书)澳洲悉尼大学毕业证成绩单原版一比一diploma 1
 
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一z xss
 
Passbook project document_april_21__.pdf
Passbook project document_april_21__.pdfPassbook project document_april_21__.pdf
Passbook project document_april_21__.pdfvaibhavkanaujia
 
韩国SKKU学位证,成均馆大学毕业证书1:1制作
韩国SKKU学位证,成均馆大学毕业证书1:1制作韩国SKKU学位证,成均馆大学毕业证书1:1制作
韩国SKKU学位证,成均馆大学毕业证书1:1制作7tz4rjpd
 
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,Aginakm1
 
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一F La
 
PORTAFOLIO 2024_ ANASTASIYA KUDINOVA
PORTAFOLIO   2024_  ANASTASIYA  KUDINOVAPORTAFOLIO   2024_  ANASTASIYA  KUDINOVA
PORTAFOLIO 2024_ ANASTASIYA KUDINOVAAnastasiya Kudinova
 
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一Fi L
 
shot list for my tv series two steps back
shot list for my tv series two steps backshot list for my tv series two steps back
shot list for my tv series two steps back17lcow074
 
ARt app | UX Case Study
ARt app | UX Case StudyARt app | UX Case Study
ARt app | UX Case StudySophia Viganò
 
group_15_empirya_p1projectIndustrial.pdf
group_15_empirya_p1projectIndustrial.pdfgroup_15_empirya_p1projectIndustrial.pdf
group_15_empirya_p1projectIndustrial.pdfneelspinoy
 
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一F dds
 
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10uasjlagroup
 

Recently uploaded (20)

(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
(办理学位证)埃迪斯科文大学毕业证成绩单原版一比一
 
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
办理卡尔顿大学毕业证成绩单|购买加拿大文凭证书
 
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
2024新版美国旧金山州立大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree 毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
毕业文凭制作#回国入职#diploma#degree澳洲弗林德斯大学毕业证成绩单pdf电子版制作修改#毕业文凭制作#回国入职#diploma#degree
 
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
PORTFOLIO DE ARQUITECTURA CRISTOBAL HERAUD 2024
 
Design principles on typography in design
Design principles on typography in designDesign principles on typography in design
Design principles on typography in design
 
办理(USYD毕业证书)澳洲悉尼大学毕业证成绩单原版一比一
办理(USYD毕业证书)澳洲悉尼大学毕业证成绩单原版一比一办理(USYD毕业证书)澳洲悉尼大学毕业证成绩单原版一比一
办理(USYD毕业证书)澳洲悉尼大学毕业证成绩单原版一比一
 
Call Girls in Pratap Nagar, 9953056974 Escort Service
Call Girls in Pratap Nagar,  9953056974 Escort ServiceCall Girls in Pratap Nagar,  9953056974 Escort Service
Call Girls in Pratap Nagar, 9953056974 Escort Service
 
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
办理(UC毕业证书)查尔斯顿大学毕业证成绩单原版一比一
 
Passbook project document_april_21__.pdf
Passbook project document_april_21__.pdfPassbook project document_april_21__.pdf
Passbook project document_april_21__.pdf
 
韩国SKKU学位证,成均馆大学毕业证书1:1制作
韩国SKKU学位证,成均馆大学毕业证书1:1制作韩国SKKU学位证,成均馆大学毕业证书1:1制作
韩国SKKU学位证,成均馆大学毕业证书1:1制作
 
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,
'CASE STUDY OF INDIRA PARYAVARAN BHAVAN DELHI ,
 
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一
办理(宾州州立毕业证书)美国宾夕法尼亚州立大学毕业证成绩单原版一比一
 
PORTAFOLIO 2024_ ANASTASIYA KUDINOVA
PORTAFOLIO   2024_  ANASTASIYA  KUDINOVAPORTAFOLIO   2024_  ANASTASIYA  KUDINOVA
PORTAFOLIO 2024_ ANASTASIYA KUDINOVA
 
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
办理学位证(TheAuckland证书)新西兰奥克兰大学毕业证成绩单原版一比一
 
shot list for my tv series two steps back
shot list for my tv series two steps backshot list for my tv series two steps back
shot list for my tv series two steps back
 
ARt app | UX Case Study
ARt app | UX Case StudyARt app | UX Case Study
ARt app | UX Case Study
 
group_15_empirya_p1projectIndustrial.pdf
group_15_empirya_p1projectIndustrial.pdfgroup_15_empirya_p1projectIndustrial.pdf
group_15_empirya_p1projectIndustrial.pdf
 
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
办理学位证(SFU证书)西蒙菲莎大学毕业证成绩单原版一比一
 
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
CREATING A POSITIVE SCHOOL CULTURE CHAPTER 10
 

Steps for CSS Layout

  • 1. CSS Layout – Steps http://flic.kr/p/9P5DTb
  • 2. CSS Layout – Steps 1. Consider each element! Which box belongs where? Create a declaration for each element.
  • 3. News Static Login #news #info #login
  • 4. CSS Layout – Steps 1. Consider each element! Which box belongs where? Create a declaration for each element. 2. Think of the widths! Do design rules like the golden ratio or a grid play a role?
  • 5. The Golden Ratio goldenratiocalculator.com
  • 6. Grid Based Designs http://grid-based.com/
  • 7. CSS Layout – Steps 1. Consider each element! Which box belongs where? Create a declaration for each element. 2. Think of the widths! Do design rules like the golden ratio or a grid play a role? 3. Calculate the values! Sorry, you need to do some maths here…
  • 8. 28% + 2% + 50% + 2% + 18% = 100% 220px + 20px + 480px + 20px + 220px = 960px It needs to add up or your layout will break!
  • 9. CSS Layout – Steps 1. Consider each element! Which box belongs where? Create a declaration for each element. 2. Think of the widths! Do design rules like the golden ratio or a grid play a role? 3. Calculate the values! Sorry, you need to do some maths here… 4. Apply the values in the CSS! Try to be as concise as possible!
  • 10. #red { background-color: red; width: 18%; height: 400px; margin: 0 2% 0 0; } #green { background-color: green; width: 50%; height: 400px; margin: 0 2% 0 0; } #blue { background-color: blue; width: 28%; height: 400px; margin: 0; }
  • 11. CSS Layout – Steps 1. Consider each element! Which box belongs where? Create a declaration for each element. 2. Think of the widths! Do design rules like the golden ratio or a grid play a role? 3. Calculate the values! Sorry, you need to do some maths here… 4. Apply the values in the CSS! Try to be as concise as possible! 5. Choose the method of layout! Is it going to be float or position?
  • 12. VS http://flic.kr/p/56L7gN http://flic.kr/p/aeLWkc • text related images • elements in a • varying heights in concreted position column layout • need to overwrite ( less hassle) document flow • listing things • flexible (document flow • need to overlap matters)
  • 13. VS http://flic.kr/p/56L7gN http://flic.kr/p/aeLWkc Rule If elements should not interact, use absolute positioning, if they should, use floats. —says Kilian Valkhof kilianvalkhof.com
  • 14. CSS Layout – Steps 1. Consider each element! Which box belongs where? Create a declaration for each element. 2. Think of the widths! Do design rules like the golden ratio or a grid play a role? 3. Calculate the values! Sorry, you need to do some maths here… 4. Apply the values in the CSS! Try to be a concise as possible! 5. Choose the method of layout! Is it going to be float or position? 6. Apply the method in the CSS! Know where to put things!
  • 15. #red { #red { background-color: red; background-color: red; width: 18%; width: 18%; height: 400px; height: 400px; position: absolute; margin: 0 2% 0 0; top: 0; float: left; left: 0; } } #green { #green { background-color: green; background-color: green; width: 50%; width: 50%; height: 400px; height: 400px; margin: 0 2% 0 0; position: absolute; top: 0; float: left; left: 20%; } } #blue { #blue { background-color: blue; background-color: blue; width: 28%; width: 28%; height: 400px; height: 400px; margin: 0; position: absolute; float: left; top: 0; } left: 72%; }
  • 16. CSS Layout – Steps 1. Consider each element! Which box belongs where? Create a declaration for each element. 2. Think of the widths! Do design rules like the golden ratio or a grid play a role? 3. Calculate the values! Sorry, you need to do some maths here… 4. Apply the values in the CSS! Try to be as concise as possible! 5. Choose the method of layout! Is it going to be float or position? 6. Apply the method in the CSS! Know where to put things! 7. Rewrite the CSS with combined selectors and shorthand notation!
  • 17. #red { background-color: red; width: 18%; height: 400px; margin: 0 2% 0 0; float: left; } #green { background-color: green; width: 50%; height: 400px; margin: 0 2% 0 0; float: left; } #blue { background-color: blue; width: 28%; height: 400px; margin: 0; float: left; }
  • 18. #red { #red { background-color: red; width: 18%; height: 400px; margin: 0 2% 0 0; float: left; } } #green { #green { background-color: green; width: 50%; height: 400px; margin: 0 2% 0 0; float: left; } } #blue { #blue { background-color: blue; width: 28%; height: 400px; margin: 0; float: left; } }
  • 19. #red, #green, #blue { #red { height: 400px; background-color: red; float: left; width: 18%; } #red, #green { margin: 0 2% 0 0; } } #blue { #green { margin: 0; background-color: green; } width: 50%; } #blue { background-color: blue; width: 28%; }
  • 20. #red, #green, #blue { height: 400px; float: left; } #red, #green { margin: 0 2% 0 0; } #red { background-color: red; width: 18%; } #green { background-color: green; width: 50%; } #blue { background-color: blue; width: 28%; margin: 0; }
  • 21. CSS Layout – Steps 1. Consider each element! Which box belongs where? Create a declaration for each element. 2. Think of the widths! Do design rules like the golden ratio or a grid play a role? 3. Calculate the values! Sorry, you need to do some maths here… 4. Apply the values in the CSS! Try to be as concise as possible! 5. Choose the method of layout! Is it going to be float or position? 6. Apply the method in the CSS! Know where to put things! 7. Rewrite the CSS with combined selectors and shorthand notation!