SlideShare une entreprise Scribd logo
1  sur  20
CSS	
  and	
  Layout	
  

            Jussi	
  Pohjolainen	
  
Tampere	
  University	
  of	
  Applied	
  Sciences	
  
XHTML	
  Related	
  CSS	
  Elements	
  
•  You	
  can	
  group	
  XHTML	
  –	
  page	
  using	
  div	
  and	
  
   span	
  elements	
  
•  div	
  and	
  span	
  elements	
  do	
  not	
  do	
  anything,	
  
   unless	
  they	
  are	
  connected	
  to	
  css	
  
•  xhtml:	
  
    –  <p>Text text text <span class="important">text
       text</span>. Text text text.</p>
•  CSS:	
  
    –  span.important { color: RGB(255,0,0); }
span	
  and	
  div?	
  
•  By	
  using	
  div,	
  you	
  can	
  divide	
  xhtml	
  –	
  page	
  in	
  to	
  
   logical	
  pieces.	
  The	
  posiKon	
  of	
  these	
  are	
  
   defined	
  in	
  CSS	
  
     –  Example:	
  navigaKon,	
  header,	
  footer,	
  contents	
  
•  Span	
  is	
  used	
  to	
  give	
  layout	
  for	
  text	
  
span	
  and	
  div	
  
<div class="header">
   <h1>Title</h1>
</div>
<div class="contents">
   <p>Contents: <span
   class="highlight">this is different</span></p>
</div>
<div class="footer">
    <p>Copyright 2008</p>
</div>
Layout	
  Basics	
  
•  XHTML	
  page	
  is	
  divided	
  into	
  “boxes”	
  by	
  using	
  
   the	
  div-­‐element	
  
•  Box	
  consists	
  of	
  
    –  Content	
  
    –  Padding	
  
    –  Border	
  
    –  Marginal	
  
CSS	
  Box	
  Model	
  
CSS	
  Box	
  Model	
  
p.leipateksti {
    border: 1px solid black;
}
CSS	
  Box	
  Model	
  
p.leipateksti {
    border: 1px solid black;
    width: 50%;
}
CSS	
  Box	
  Model	
  
p.leipateksti {
    border: 1px solid black;
    padding: 20px;
}
CSS	
  Box	
  Model	
  
p.leipateksti {
    border: 1px solid black;
    margin: 20px;
}
Features	
  
•  Margins	
  
    –  margin-top
    –  margin-bottom
    –  margin-left
    –  margin-right
    –  All	
  together:	
  margin
•  Padding	
  
    –  padding-­‐top	
  
    –  padding-­‐boRom	
  
    –  padding-­‐leS	
  
    –  padding-­‐right	
  
    –  All	
  together:	
  padding
Features	
  
•  Borders	
  
     –    border-top-width
     –    border-bottom-width
     –    border-right-width
     –    border-left-width
     –    border-width
     –    border-color
     –    border-style (none, dotted, solid, double, groove, ridge, inset,
          outset)
•  CombinaKons	
  
    –  border-top
    –  border-right
    –  border-bottom
    –  border-left
•  All	
  together	
  
    –  border
Features	
  
•  width
•  height
•  float (none, left, right)
h1 {
                        Example	
  
    font-family:        Arial, Helvetica, sans-serif;
    color:              RGB(0,0,255);
    background-color:   RGB(200,200,200);
    border:             2px dotted RGB(0,0,0);
    padding:            10px;
    text-align:         center;
}
Example:	
  Layout	
  
<html>
<head><title>Otsikko</title></head>
<body>
    <!– whole page inside one div -->
    <div id="wholepage">

    </div>
  </body>
</html>
Example:	
  Layout	
  
<html>
<head><title>Otsikko</title></head>
<body>
    <div id="wholepage">
        <div id="header">
            <!– Title -->
        </div>
        <div id="navigation">
            <!– Navigation -->
        </div>
        <div id="contents">
            <!– Contents -->
        </div>
          <div id="footer">
            <!– Footer -->
        </div>
    </div>
  </body>
</html>
Example:	
  Layout	
  
#wholepage
{
    width:              100%;
    background-color:   RGB(255,255,255);
    color:              RGB(0,0,0);
    border:             1px solid RGB(100,100,100);
}
Example:	
  Layout	
  
#header
{
    padding:            10px;
    background-color:   RGB(220,220,220);
    border-bottom:      1px solid RGB(100,100,100);
}

#navigation
{
    float:              left;
    width:              160px;
    margin:             0;
    padding:            10px;
}
Example:	
  Layout	
  
#contents
{
    margin-left:        200px;
    border-left:        1px solid RGB(100,100,100);
    padding:            10px;
    max-width:          600px;
}

#footer
{
    padding:            10px;
    color:              RGB(100,100,100);
    background-color:   RGB(220,220,220);
    border-top:         1px solid RGB(100,100,100);
}
Result	
  

Contenu connexe

Tendances

CSS preprocessor: why and how
CSS preprocessor: why and howCSS preprocessor: why and how
CSS preprocessor: why and how
mirahman
 
Basic HTML & CSS
Basic HTML & CSSBasic HTML & CSS
Basic HTML & CSS
John Nelson
 

Tendances (20)

CSS Walktrough Internship Course
CSS Walktrough Internship CourseCSS Walktrough Internship Course
CSS Walktrough Internship Course
 
CSS for basic learner
CSS for basic learnerCSS for basic learner
CSS for basic learner
 
Haml and Sass Introduction
Haml and Sass IntroductionHaml and Sass Introduction
Haml and Sass Introduction
 
From PSD to WordPress Theme: Bringing designs to life
From PSD to WordPress Theme: Bringing designs to lifeFrom PSD to WordPress Theme: Bringing designs to life
From PSD to WordPress Theme: Bringing designs to life
 
CSS preprocessor: why and how
CSS preprocessor: why and howCSS preprocessor: why and how
CSS preprocessor: why and how
 
Css introduction
Css  introductionCss  introduction
Css introduction
 
CSS Box Model
CSS Box ModelCSS Box Model
CSS Box Model
 
2 introduction css
2 introduction css2 introduction css
2 introduction css
 
Cascading style sheets - CSS
Cascading style sheets - CSSCascading style sheets - CSS
Cascading style sheets - CSS
 
[Worskhop Summits] CSS3 Workshop
[Worskhop Summits] CSS3 Workshop[Worskhop Summits] CSS3 Workshop
[Worskhop Summits] CSS3 Workshop
 
Css
CssCss
Css
 
Html
HtmlHtml
Html
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
CSS3 Media Queries
CSS3 Media QueriesCSS3 Media Queries
CSS3 Media Queries
 
Fundamental CSS3
Fundamental CSS3Fundamental CSS3
Fundamental CSS3
 
Intro to SASS CSS
Intro to SASS CSSIntro to SASS CSS
Intro to SASS CSS
 
CSS3: Simply Responsive
CSS3: Simply ResponsiveCSS3: Simply Responsive
CSS3: Simply Responsive
 
css v1 guru
css v1 gurucss v1 guru
css v1 guru
 
CSS: a rapidly changing world
CSS: a rapidly changing worldCSS: a rapidly changing world
CSS: a rapidly changing world
 
Basic HTML & CSS
Basic HTML & CSSBasic HTML & CSS
Basic HTML & CSS
 

En vedette

Android Security, Signing and Publishing
Android Security, Signing and PublishingAndroid Security, Signing and Publishing
Android Security, Signing and Publishing
Jussi Pohjolainen
 
Introduction to Mobile Programming 2 - course
Introduction to Mobile Programming 2 - courseIntroduction to Mobile Programming 2 - course
Introduction to Mobile Programming 2 - course
Jussi Pohjolainen
 
MIDP GUI Development: Alert, List, Form, TextBox
MIDP GUI Development: Alert, List, Form, TextBoxMIDP GUI Development: Alert, List, Form, TextBox
MIDP GUI Development: Alert, List, Form, TextBox
Jussi Pohjolainen
 
Graphics, Threads and HTTPConnections in MIDLets
Graphics, Threads and HTTPConnections in MIDLetsGraphics, Threads and HTTPConnections in MIDLets
Graphics, Threads and HTTPConnections in MIDLets
Jussi Pohjolainen
 
MIDP: Form Custom and Image Items
MIDP: Form Custom and Image ItemsMIDP: Form Custom and Image Items
MIDP: Form Custom and Image Items
Jussi Pohjolainen
 
Introduction to Web Standards
Introduction to Web StandardsIntroduction to Web Standards
Introduction to Web Standards
Jussi Pohjolainen
 
.NET Multithreading and File I/O
.NET Multithreading and File I/O.NET Multithreading and File I/O
.NET Multithreading and File I/O
Jussi Pohjolainen
 
iOS: Frameworks and Delegation
iOS: Frameworks and DelegationiOS: Frameworks and Delegation
iOS: Frameworks and Delegation
Jussi Pohjolainen
 
Introduction to Web Application Course
Introduction to Web Application CourseIntroduction to Web Application Course
Introduction to Web Application Course
Jussi Pohjolainen
 

En vedette (20)

Intro to MIDP Development
Intro to MIDP DevelopmentIntro to MIDP Development
Intro to MIDP Development
 
Android Security, Signing and Publishing
Android Security, Signing and PublishingAndroid Security, Signing and Publishing
Android Security, Signing and Publishing
 
Introduction to Mobile Programming 2 - course
Introduction to Mobile Programming 2 - courseIntroduction to Mobile Programming 2 - course
Introduction to Mobile Programming 2 - course
 
iPhone OS Platform
iPhone OS PlatformiPhone OS Platform
iPhone OS Platform
 
MIDP GUI Development: Alert, List, Form, TextBox
MIDP GUI Development: Alert, List, Form, TextBoxMIDP GUI Development: Alert, List, Form, TextBox
MIDP GUI Development: Alert, List, Form, TextBox
 
Graphics, Threads and HTTPConnections in MIDLets
Graphics, Threads and HTTPConnections in MIDLetsGraphics, Threads and HTTPConnections in MIDLets
Graphics, Threads and HTTPConnections in MIDLets
 
MIDP: Game API
MIDP: Game APIMIDP: Game API
MIDP: Game API
 
MIDP: Form Custom and Image Items
MIDP: Form Custom and Image ItemsMIDP: Form Custom and Image Items
MIDP: Form Custom and Image Items
 
iPhone: Http Connection
iPhone: Http ConnectioniPhone: Http Connection
iPhone: Http Connection
 
Introduction to Web Standards
Introduction to Web StandardsIntroduction to Web Standards
Introduction to Web Standards
 
Johdatus olio-ohjelmointiin
Johdatus olio-ohjelmointiinJohdatus olio-ohjelmointiin
Johdatus olio-ohjelmointiin
 
.NET Multithreading and File I/O
.NET Multithreading and File I/O.NET Multithreading and File I/O
.NET Multithreading and File I/O
 
iOS: Frameworks and Delegation
iOS: Frameworks and DelegationiOS: Frameworks and Delegation
iOS: Frameworks and Delegation
 
C++: Interface as Concept
C++: Interface as ConceptC++: Interface as Concept
C++: Interface as Concept
 
MIDP: Persistant Storage
MIDP: Persistant StorageMIDP: Persistant Storage
MIDP: Persistant Storage
 
Introduction to Web Application Course
Introduction to Web Application CourseIntroduction to Web Application Course
Introduction to Web Application Course
 
libGDX: Scene2D
libGDX: Scene2DlibGDX: Scene2D
libGDX: Scene2D
 
JavaScript Inheritance
JavaScript InheritanceJavaScript Inheritance
JavaScript Inheritance
 
iPhone University Developer Program
iPhone University Developer ProgramiPhone University Developer Program
iPhone University Developer Program
 
Implementing a Simple Game using libGDX
Implementing a Simple Game using libGDXImplementing a Simple Game using libGDX
Implementing a Simple Game using libGDX
 

Similaire à CSS and Layout

Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
Senthil Kumar
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
tutorialsruby
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
tutorialsruby
 

Similaire à CSS and Layout (20)

Web - CSS 1.pptx
Web - CSS 1.pptxWeb - CSS 1.pptx
Web - CSS 1.pptx
 
CSS
CSSCSS
CSS
 
Layout with CSS
Layout with CSSLayout with CSS
Layout with CSS
 
WT CSS
WT  CSSWT  CSS
WT CSS
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
 
Web 102 INtro to CSS
Web 102  INtro to CSSWeb 102  INtro to CSS
Web 102 INtro to CSS
 
Unit - 3 CSS(Cascading Style Sheet).pptx
Unit - 3 CSS(Cascading Style Sheet).pptxUnit - 3 CSS(Cascading Style Sheet).pptx
Unit - 3 CSS(Cascading Style Sheet).pptx
 
Cascading Style Sheets
Cascading Style SheetsCascading Style Sheets
Cascading Style Sheets
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With Less
 
Css & css3
Css & css3Css & css3
Css & css3
 
css-note.pptx
css-note.pptxcss-note.pptx
css-note.pptx
 
Cascading Style Sheets By Mukesh
Cascading Style Sheets By MukeshCascading Style Sheets By Mukesh
Cascading Style Sheets By Mukesh
 
6_CasCadingStylesSheetsCSS.ppt
6_CasCadingStylesSheetsCSS.ppt6_CasCadingStylesSheetsCSS.ppt
6_CasCadingStylesSheetsCSS.ppt
 
Web Development - Lecture 6
Web Development - Lecture 6Web Development - Lecture 6
Web Development - Lecture 6
 
Intro to HTML & CSS
Intro to HTML & CSSIntro to HTML & CSS
Intro to HTML & CSS
 
Layouts
Layouts Layouts
Layouts
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 
cascadingstylesheets
cascadingstylesheetscascadingstylesheets
cascadingstylesheets
 
CSS
CSSCSS
CSS
 
Introdução a CSS
Introdução a CSS Introdução a CSS
Introdução a CSS
 

Plus de Jussi Pohjolainen

Advanced JavaScript Development
Advanced JavaScript DevelopmentAdvanced JavaScript Development
Advanced JavaScript Development
Jussi Pohjolainen
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame Animation
Jussi Pohjolainen
 
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesCreating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Jussi Pohjolainen
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platform
Jussi Pohjolainen
 
Intro to Java ME and Asha Platform
Intro to Java ME and Asha PlatformIntro to Java ME and Asha Platform
Intro to Java ME and Asha Platform
Jussi Pohjolainen
 

Plus de Jussi Pohjolainen (20)

Moved to Speakerdeck
Moved to SpeakerdeckMoved to Speakerdeck
Moved to Speakerdeck
 
Java Web Services
Java Web ServicesJava Web Services
Java Web Services
 
Box2D and libGDX
Box2D and libGDXBox2D and libGDX
Box2D and libGDX
 
libGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and PreferenceslibGDX: Screens, Fonts and Preferences
libGDX: Screens, Fonts and Preferences
 
libGDX: Tiled Maps
libGDX: Tiled MapslibGDX: Tiled Maps
libGDX: Tiled Maps
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame Animation
 
Intro to Building Android Games using libGDX
Intro to Building Android Games using libGDXIntro to Building Android Games using libGDX
Intro to Building Android Games using libGDX
 
Advanced JavaScript Development
Advanced JavaScript DevelopmentAdvanced JavaScript Development
Advanced JavaScript Development
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 
Introduction to AngularJS
Introduction to AngularJSIntroduction to AngularJS
Introduction to AngularJS
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame Animation
 
libGDX: Simple Frame Animation
libGDX: Simple Frame AnimationlibGDX: Simple Frame Animation
libGDX: Simple Frame Animation
 
libGDX: User Input
libGDX: User InputlibGDX: User Input
libGDX: User Input
 
Building Android games using LibGDX
Building Android games using LibGDXBuilding Android games using LibGDX
Building Android games using LibGDX
 
Android Threading
Android ThreadingAndroid Threading
Android Threading
 
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and GesturesCreating Asha Games: Game Pausing, Orientation, Sensors and Gestures
Creating Asha Games: Game Pausing, Orientation, Sensors and Gestures
 
Creating Games for Asha - platform
Creating Games for Asha - platformCreating Games for Asha - platform
Creating Games for Asha - platform
 
Intro to Asha UI
Intro to Asha UIIntro to Asha UI
Intro to Asha UI
 
Intro to Java ME and Asha Platform
Intro to Java ME and Asha PlatformIntro to Java ME and Asha Platform
Intro to Java ME and Asha Platform
 
Intro to PhoneGap
Intro to PhoneGapIntro to PhoneGap
Intro to PhoneGap
 

Dernier

1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
 

Dernier (20)

Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 

CSS and Layout

  • 1. CSS  and  Layout   Jussi  Pohjolainen   Tampere  University  of  Applied  Sciences  
  • 2. XHTML  Related  CSS  Elements   •  You  can  group  XHTML  –  page  using  div  and   span  elements   •  div  and  span  elements  do  not  do  anything,   unless  they  are  connected  to  css   •  xhtml:   –  <p>Text text text <span class="important">text text</span>. Text text text.</p> •  CSS:   –  span.important { color: RGB(255,0,0); }
  • 3. span  and  div?   •  By  using  div,  you  can  divide  xhtml  –  page  in  to   logical  pieces.  The  posiKon  of  these  are   defined  in  CSS   –  Example:  navigaKon,  header,  footer,  contents   •  Span  is  used  to  give  layout  for  text  
  • 4. span  and  div   <div class="header"> <h1>Title</h1> </div> <div class="contents"> <p>Contents: <span class="highlight">this is different</span></p> </div> <div class="footer"> <p>Copyright 2008</p> </div>
  • 5. Layout  Basics   •  XHTML  page  is  divided  into  “boxes”  by  using   the  div-­‐element   •  Box  consists  of   –  Content   –  Padding   –  Border   –  Marginal  
  • 7. CSS  Box  Model   p.leipateksti { border: 1px solid black; }
  • 8. CSS  Box  Model   p.leipateksti { border: 1px solid black; width: 50%; }
  • 9. CSS  Box  Model   p.leipateksti { border: 1px solid black; padding: 20px; }
  • 10. CSS  Box  Model   p.leipateksti { border: 1px solid black; margin: 20px; }
  • 11. Features   •  Margins   –  margin-top –  margin-bottom –  margin-left –  margin-right –  All  together:  margin •  Padding   –  padding-­‐top   –  padding-­‐boRom   –  padding-­‐leS   –  padding-­‐right   –  All  together:  padding
  • 12. Features   •  Borders   –  border-top-width –  border-bottom-width –  border-right-width –  border-left-width –  border-width –  border-color –  border-style (none, dotted, solid, double, groove, ridge, inset, outset) •  CombinaKons   –  border-top –  border-right –  border-bottom –  border-left •  All  together   –  border
  • 13. Features   •  width •  height •  float (none, left, right)
  • 14. h1 { Example   font-family: Arial, Helvetica, sans-serif; color: RGB(0,0,255); background-color: RGB(200,200,200); border: 2px dotted RGB(0,0,0); padding: 10px; text-align: center; }
  • 15. Example:  Layout   <html> <head><title>Otsikko</title></head> <body> <!– whole page inside one div --> <div id="wholepage"> </div> </body> </html>
  • 16. Example:  Layout   <html> <head><title>Otsikko</title></head> <body> <div id="wholepage"> <div id="header"> <!– Title --> </div> <div id="navigation"> <!– Navigation --> </div> <div id="contents"> <!– Contents --> </div> <div id="footer"> <!– Footer --> </div> </div> </body> </html>
  • 17. Example:  Layout   #wholepage { width: 100%; background-color: RGB(255,255,255); color: RGB(0,0,0); border: 1px solid RGB(100,100,100); }
  • 18. Example:  Layout   #header { padding: 10px; background-color: RGB(220,220,220); border-bottom: 1px solid RGB(100,100,100); } #navigation { float: left; width: 160px; margin: 0; padding: 10px; }
  • 19. Example:  Layout   #contents { margin-left: 200px; border-left: 1px solid RGB(100,100,100); padding: 10px; max-width: 600px; } #footer { padding: 10px; color: RGB(100,100,100); background-color: RGB(220,220,220); border-top: 1px solid RGB(100,100,100); }