SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
schöneres
               CSS


mit
Sass & Compass
Sass
Install & Run



$ gem install sass

$ sass --watch style.sass:style.css
$ sass --watch assets/sass:public/css
Basic Syntax
css       scss   sass
Nesting
                                                SASS
 article
     border-top: 1px dashed #eee
     header
         margin-bottom: 15px
     header, section
         color: #eee


                                                 CSS

 article { border-top: 1px dashed #eeeeee; }
 article header { margin-bottom: 15px; }
 article header, article section { color: #eeeeee; }
Parent Selector
                                           SASS
 article
     color: #f00
     &:hover
         color: #00f
     .special &
         h1
             font-size: 2em
                                           CSS

 article { color: red; }
 article:hover { color: blue; }
 .special article h1 { font-size: 2em; }
@media
                                             SASS
 #content
     margin: 0 1.5em
     @media screen and (min-width: 1280px)
         margin: 0 2.5em




                                             CSS

 #content { margin: 0 1.5em; }
 @media screen and (min-width: 1280px) {
     #content { margin: 0 2.5em; }
 }
Variablen
                                           SASS
 $link-color: #e78a15
 $link-hover: #138a1e
 $link-size: 0.8em

 a
     color: $link-color
     font-size: $link-size
     &:hover
         color: $link-hover
                                           CSS

 a { color: #e78a15; font-size: 0.8em; }
 a:hover { color: #138a1e; }
Weiterverwendung mit @extend
                                                SASS
 .button
     background-color: #00f
     color: #fff
     padding: 2em 1.5em

 .button-delete
     @extend .button
     background-color: #f00
                                                 CSS

 .button, .button-delete { background-color: blue;
 color: white; padding: 2em 1.5em; }
 .button-delete { background-color: red; }
Vorlagen mit @mixin
                                                   SASS
 @mixin hover-link
   text-decoration: none
   &:hover
     text-decoration: underline

 article a
   @include hover-link

 .nav a
   color: blue
   @include hover-link                             CSS
 article a { text-decoration: none; }
 article a:hover { text-decoration: underline; }

 .nav a { color: blue; text-decoration: none; }
 .nav a:hover { text-decoration: underline; }
Funktionen mit @mixin
                                      SASS
 @mixin border-radius($amount)
     border-radius: $amount
     -mox-border-radius: $amount
     -webkit-border-radius: $amount

 .alert
     @include border-radius(5px)
                                      CSS

 .alert {
     border-radius: 5px;
     -mox-border-radius: 5px;
     -webkit-border-radius: 5px;
 }
benannte Argumente mit @mixin
                                                  SASS
 @mixin flash-message($bgcolor:red, $hovercolor:blue)
     background-color: $bgcolor
     &:hover
         background-color: $hovercolor

 .alertbox
     @include flash-message($hovercolor: green)
                                                  CSS

 .alertbox { background-color: red; }
 .alertbox:hover { background-color: green; }
Import
 pages/
     _user.sass
 screen.sass
 _variables.sass
 _grid.sass
 _typography.sass
 _phone.sass
                                        SASS
 /* screen.sass */
 @import "variables"
 @import "grid"
 @import "grid", "typography"

 @media screen and (min-width: 480px)
     @import "phone"

 #user
     @import "pages/user"
etwas Mathematik
                                                   SASS
font-size: 18px - 5px
width: 200px * 3


Beispiel:

$layout-space: 10px
$sidebar-width: 250px
$page-width: 960px

#main
    width: $page-width - $sidebar-width - (2 * $layout-space)
                                                   CSS

#main { width: 690px; }
Mathematische Funktionen



abs(-43)            // => 43
floor(3.9)          // => 3
ceil(3.2)           // => 4
round(2.8)          // => 3
percentage(13/25)   // => 52%
Mehr ...

- Bedingungen (@if, @else, @elseif)
- Logische Operatoren (<, >, >=, <=, ==, !=)
- Verknuepfungen (and, or)
- Schleifen (@for, @while, @each)
- Farb-Inspektoren (hue, saturation, lightness, ..)
- Farb-Funktionen (invert, mix, grayscale, darken, ..)
- eigene Funktionen (@function)
...
Compass




@mixin & @function Sammlung
Installation


$ gem install compass

$   compass create my_project
$   cd my_project
$   vim config.rb
$   compass watch

oder

$ sass --compass --watch assets/sass:public/css
Cross Browser CSS3 Mixins

●   Appearance          ●   Filter
●   Background Clip     ●   Font Face
●   Background Origin   ●   Hyphenation
●   Background Size     ●   Images (Gradients)
●   Border Radius       ●   Inline Block
●   Box                 ●   Opacity
●   Box Shadow          ●   CSS Regions
●   Box Sizing          ●   Text Shadow
●   Columns             ●   Transform
                        ●   Transition
Beispiel CSS3 Mixins
                                                  SASS
@import "compass"
.flash-message
  @include background(linear-gradient(#fff, #eee))
  @include border-radius(5px)
                                                     CSS

.flash-message {
    background: -webkit-gradient(linear, 50% 0%, 50% 100%,
    color-stop(0%, #ffffff), color-stop(100%, #eeeeee));
    background: -webkit-linear-gradient(#ffffff, #eeeeee);
    background: -moz-linear-gradient(#ffffff, #eeeeee);
    background: -o-linear-gradient(#ffffff, #eeeeee);
    background: linear-gradient(#ffffff, #eeeeee); -webkit-
    border-radius: 5px; -moz-border-radius: 5px; -ms-
    border-radius: 5px; -o-border-radius: 5px; border-
    radius: 5px;
}
Layout Helper

Grid Background
  Grid als Seitenhintergrund mithilfe CSS3 Gradients

Sticky Footer
  Footer am Seitenende

Stretching
  Dimensionen eines Divs auf das Elternelement
  ausweiten
Utilities


Reset (global, einzelne Resets (Font, body, ..)
Cross Browser Clearfix
Cross Browser Floats
has-layout Hacks
...
Sprites
                                                    SASS

@import "compass"
@import "social/*.png"
@include all-social-sprites
                                                    CSS

.icons-sprite, .icons-facebook, .icons-flickr, .icons-
twitter, .icons-xing { background: url('/images/icons-
s2d05e1e0af.png') no-repeat; }

.icons-facebook { background-position: 0 -48px; }

.icons-flickr { background-position: 0 -16px; }

.icons-twitter { background-position: 0 -32px; }

.icons-xing { background-position: 0 0; }
Informations
● Sass - sass-lang.com
● Sass Ruby on Rails Implementation
  github.com/rails/sass-rails

● Compass - compass-style.org

● Noch mehr Infos
  ○ 35 Great Resources for Compass and Sass
  ○ Sass & Compass: The future of stylesheets now
  ○ css2sass converter
Personal



Stefan Bauckmeier
AKRA GmbH
http://twitter.com/emrox
http://trafex.de
https://www.xing.com/profile/Stefan_Bauckmeier

Mais conteúdo relacionado

Mais procurados

SASS is more than LESS
SASS is more than LESSSASS is more than LESS
SASS is more than LESSItai Koren
 
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 lifeDerek Christensen
 
CSS'in Gücü Adına
CSS'in Gücü AdınaCSS'in Gücü Adına
CSS'in Gücü AdınaAdem Ilter
 
Modularization css with sass
Modularization css with sassModularization css with sass
Modularization css with sassHuiyi Yan
 
Front-End Dev Tools
Front-End Dev ToolsFront-End Dev Tools
Front-End Dev ToolsNetguru
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With LessDavid Engel
 
Sass, Compass and the new tools - Open Web Camp IV
Sass, Compass and the new tools - Open Web Camp IVSass, Compass and the new tools - Open Web Camp IV
Sass, Compass and the new tools - Open Web Camp IVDirk Ginader
 
LESS, the CSS Preprocessor
LESS, the CSS PreprocessorLESS, the CSS Preprocessor
LESS, the CSS PreprocessorAndrea Tarr
 
Using LESS, the CSS Preprocessor: J and Beyond 2013
Using LESS, the CSS Preprocessor: J and Beyond 2013Using LESS, the CSS Preprocessor: J and Beyond 2013
Using LESS, the CSS Preprocessor: J and Beyond 2013Andrea Tarr
 
CSS with LESS for #jd13nl
CSS with LESS for #jd13nlCSS with LESS for #jd13nl
CSS with LESS for #jd13nlHans Kuijpers
 

Mais procurados (20)

SASS is more than LESS
SASS is more than LESSSASS is more than LESS
SASS is more than LESS
 
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'in Gücü Adına
CSS'in Gücü AdınaCSS'in Gücü Adına
CSS'in Gücü Adına
 
LESS
LESSLESS
LESS
 
Theme04
Theme04Theme04
Theme04
 
Accelerated Stylesheets
Accelerated StylesheetsAccelerated Stylesheets
Accelerated Stylesheets
 
Modularization css with sass
Modularization css with sassModularization css with sass
Modularization css with sass
 
Sass compass
Sass compassSass compass
Sass compass
 
Front-End Dev Tools
Front-End Dev ToolsFront-End Dev Tools
Front-End Dev Tools
 
Theme01
Theme01Theme01
Theme01
 
Doing More With Less
Doing More With LessDoing More With Less
Doing More With Less
 
Compass/Sass
Compass/SassCompass/Sass
Compass/Sass
 
Sass, Compass and the new tools - Open Web Camp IV
Sass, Compass and the new tools - Open Web Camp IVSass, Compass and the new tools - Open Web Camp IV
Sass, Compass and the new tools - Open Web Camp IV
 
Theme 23
Theme 23Theme 23
Theme 23
 
This is a test
This is a testThis is a test
This is a test
 
Css frameworks
Css frameworksCss frameworks
Css frameworks
 
LESS, the CSS Preprocessor
LESS, the CSS PreprocessorLESS, the CSS Preprocessor
LESS, the CSS Preprocessor
 
Using LESS, the CSS Preprocessor: J and Beyond 2013
Using LESS, the CSS Preprocessor: J and Beyond 2013Using LESS, the CSS Preprocessor: J and Beyond 2013
Using LESS, the CSS Preprocessor: J and Beyond 2013
 
CSS with LESS for #jd13nl
CSS with LESS for #jd13nlCSS with LESS for #jd13nl
CSS with LESS for #jd13nl
 
Sass Essentials
Sass EssentialsSass Essentials
Sass Essentials
 

Destaque

Merancang penerbitanbahan video untuk pengajaran
Merancang penerbitanbahan video untuk pengajaranMerancang penerbitanbahan video untuk pengajaran
Merancang penerbitanbahan video untuk pengajaranSnexon Jajan Maria
 
New microsoft power point presentation
New microsoft power point presentationNew microsoft power point presentation
New microsoft power point presentationSnexon Jajan Maria
 
Radio-frequency_identification‎
Radio-frequency_identification‎ Radio-frequency_identification‎
Radio-frequency_identification‎ Mubashir Hassan
 

Destaque (6)

Merancang penerbitanbahan video untuk pengajaran
Merancang penerbitanbahan video untuk pengajaranMerancang penerbitanbahan video untuk pengajaran
Merancang penerbitanbahan video untuk pengajaran
 
Mapkinds
MapkindsMapkinds
Mapkinds
 
New microsoft power point presentation
New microsoft power point presentationNew microsoft power point presentation
New microsoft power point presentation
 
Install
InstallInstall
Install
 
RECONNECT
RECONNECTRECONNECT
RECONNECT
 
Radio-frequency_identification‎
Radio-frequency_identification‎ Radio-frequency_identification‎
Radio-frequency_identification‎
 

Semelhante a Sass & Compass (Barcamp Stuttgart 2012)

Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Startededgincvg
 
SASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, GreensockSASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, GreensockMarco Pinheiro
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentationMario Noble
 
Using Sass - Building on CSS
Using Sass - Building on CSSUsing Sass - Building on CSS
Using Sass - Building on CSSSayanee Basu
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid PrototypingEven Wu
 
CSS3 is Not Magic Pixie Dust
CSS3 is Not Magic Pixie DustCSS3 is Not Magic Pixie Dust
CSS3 is Not Magic Pixie DustKyle Adams
 
LESS : The dynamic stylesheet language
LESS : The dynamic stylesheet languageLESS : The dynamic stylesheet language
LESS : The dynamic stylesheet languageKatsunori Tanaka
 
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive NewsMobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive NewsKaelig Deloumeau-Prigent
 
Palestra pré processadores CSS
Palestra pré processadores CSSPalestra pré processadores CSS
Palestra pré processadores CSSJust Digital
 
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Adam Darowski
 
Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction SassZeeshan Ahmed
 
Learn Sass and Compass quick
Learn Sass and Compass quickLearn Sass and Compass quick
Learn Sass and Compass quickBilly Shih
 
CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書拓樹 谷
 
CSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassLucien Lee
 
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"bentleyhoke
 

Semelhante a Sass & Compass (Barcamp Stuttgart 2012) (20)

Sass and Compass - Getting Started
Sass and Compass - Getting StartedSass and Compass - Getting Started
Sass and Compass - Getting Started
 
SASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, GreensockSASS, Compass, Gulp, Greensock
SASS, Compass, Gulp, Greensock
 
Preprocessor presentation
Preprocessor presentationPreprocessor presentation
Preprocessor presentation
 
Using Sass - Building on CSS
Using Sass - Building on CSSUsing Sass - Building on CSS
Using Sass - Building on CSS
 
Rapid Prototyping
Rapid PrototypingRapid Prototyping
Rapid Prototyping
 
CSS3 is Not Magic Pixie Dust
CSS3 is Not Magic Pixie DustCSS3 is Not Magic Pixie Dust
CSS3 is Not Magic Pixie Dust
 
LESS : The dynamic stylesheet language
LESS : The dynamic stylesheet languageLESS : The dynamic stylesheet language
LESS : The dynamic stylesheet language
 
CSS3
CSS3CSS3
CSS3
 
PostCss
PostCssPostCss
PostCss
 
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive NewsMobile-first OOCSS, Sass & Compass at BBC Responsive News
Mobile-first OOCSS, Sass & Compass at BBC Responsive News
 
Palestra pré processadores CSS
Palestra pré processadores CSSPalestra pré processadores CSS
Palestra pré processadores CSS
 
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
Sassive Aggressive: Using Sass to Make Your Life Easier (Refresh Boston Version)
 
Simple introduction Sass
Simple introduction SassSimple introduction Sass
Simple introduction Sass
 
Less css
Less cssLess css
Less css
 
Learn Sass and Compass quick
Learn Sass and Compass quickLearn Sass and Compass quick
Learn Sass and Compass quick
 
CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書CSSプリプロセッサの取扱説明書
CSSプリプロセッサの取扱説明書
 
Intro to SASS CSS
Intro to SASS CSSIntro to SASS CSS
Intro to SASS CSS
 
CSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & CompassCSS 開發加速指南-Sass & Compass
CSS 開發加速指南-Sass & Compass
 
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
Brian Hoke: WordCamp Toronto 2014 Presentation "Sass & WordPress"
 
SASS Lecture
SASS Lecture SASS Lecture
SASS Lecture
 

Último

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Último (20)

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Sass & Compass (Barcamp Stuttgart 2012)

  • 1.
  • 2. schöneres CSS mit Sass & Compass
  • 4. Install & Run $ gem install sass $ sass --watch style.sass:style.css $ sass --watch assets/sass:public/css
  • 5. Basic Syntax css scss sass
  • 6. Nesting SASS article border-top: 1px dashed #eee header margin-bottom: 15px header, section color: #eee CSS article { border-top: 1px dashed #eeeeee; } article header { margin-bottom: 15px; } article header, article section { color: #eeeeee; }
  • 7. Parent Selector SASS article color: #f00 &:hover color: #00f .special & h1 font-size: 2em CSS article { color: red; } article:hover { color: blue; } .special article h1 { font-size: 2em; }
  • 8. @media SASS #content margin: 0 1.5em @media screen and (min-width: 1280px) margin: 0 2.5em CSS #content { margin: 0 1.5em; } @media screen and (min-width: 1280px) { #content { margin: 0 2.5em; } }
  • 9. Variablen SASS $link-color: #e78a15 $link-hover: #138a1e $link-size: 0.8em a color: $link-color font-size: $link-size &:hover color: $link-hover CSS a { color: #e78a15; font-size: 0.8em; } a:hover { color: #138a1e; }
  • 10. Weiterverwendung mit @extend SASS .button background-color: #00f color: #fff padding: 2em 1.5em .button-delete @extend .button background-color: #f00 CSS .button, .button-delete { background-color: blue; color: white; padding: 2em 1.5em; } .button-delete { background-color: red; }
  • 11. Vorlagen mit @mixin SASS @mixin hover-link text-decoration: none &:hover text-decoration: underline article a @include hover-link .nav a color: blue @include hover-link CSS article a { text-decoration: none; } article a:hover { text-decoration: underline; } .nav a { color: blue; text-decoration: none; } .nav a:hover { text-decoration: underline; }
  • 12. Funktionen mit @mixin SASS @mixin border-radius($amount) border-radius: $amount -mox-border-radius: $amount -webkit-border-radius: $amount .alert @include border-radius(5px) CSS .alert { border-radius: 5px; -mox-border-radius: 5px; -webkit-border-radius: 5px; }
  • 13. benannte Argumente mit @mixin SASS @mixin flash-message($bgcolor:red, $hovercolor:blue) background-color: $bgcolor &:hover background-color: $hovercolor .alertbox @include flash-message($hovercolor: green) CSS .alertbox { background-color: red; } .alertbox:hover { background-color: green; }
  • 14. Import pages/ _user.sass screen.sass _variables.sass _grid.sass _typography.sass _phone.sass SASS /* screen.sass */ @import "variables" @import "grid" @import "grid", "typography" @media screen and (min-width: 480px) @import "phone" #user @import "pages/user"
  • 15. etwas Mathematik SASS font-size: 18px - 5px width: 200px * 3 Beispiel: $layout-space: 10px $sidebar-width: 250px $page-width: 960px #main width: $page-width - $sidebar-width - (2 * $layout-space) CSS #main { width: 690px; }
  • 16. Mathematische Funktionen abs(-43) // => 43 floor(3.9) // => 3 ceil(3.2) // => 4 round(2.8) // => 3 percentage(13/25) // => 52%
  • 17. Mehr ... - Bedingungen (@if, @else, @elseif) - Logische Operatoren (<, >, >=, <=, ==, !=) - Verknuepfungen (and, or) - Schleifen (@for, @while, @each) - Farb-Inspektoren (hue, saturation, lightness, ..) - Farb-Funktionen (invert, mix, grayscale, darken, ..) - eigene Funktionen (@function) ...
  • 19. Installation $ gem install compass $ compass create my_project $ cd my_project $ vim config.rb $ compass watch oder $ sass --compass --watch assets/sass:public/css
  • 20. Cross Browser CSS3 Mixins ● Appearance ● Filter ● Background Clip ● Font Face ● Background Origin ● Hyphenation ● Background Size ● Images (Gradients) ● Border Radius ● Inline Block ● Box ● Opacity ● Box Shadow ● CSS Regions ● Box Sizing ● Text Shadow ● Columns ● Transform ● Transition
  • 21. Beispiel CSS3 Mixins SASS @import "compass" .flash-message @include background(linear-gradient(#fff, #eee)) @include border-radius(5px) CSS .flash-message { background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #ffffff), color-stop(100%, #eeeeee)); background: -webkit-linear-gradient(#ffffff, #eeeeee); background: -moz-linear-gradient(#ffffff, #eeeeee); background: -o-linear-gradient(#ffffff, #eeeeee); background: linear-gradient(#ffffff, #eeeeee); -webkit- border-radius: 5px; -moz-border-radius: 5px; -ms- border-radius: 5px; -o-border-radius: 5px; border- radius: 5px; }
  • 22. Layout Helper Grid Background Grid als Seitenhintergrund mithilfe CSS3 Gradients Sticky Footer Footer am Seitenende Stretching Dimensionen eines Divs auf das Elternelement ausweiten
  • 23. Utilities Reset (global, einzelne Resets (Font, body, ..) Cross Browser Clearfix Cross Browser Floats has-layout Hacks ...
  • 24. Sprites SASS @import "compass" @import "social/*.png" @include all-social-sprites CSS .icons-sprite, .icons-facebook, .icons-flickr, .icons- twitter, .icons-xing { background: url('/images/icons- s2d05e1e0af.png') no-repeat; } .icons-facebook { background-position: 0 -48px; } .icons-flickr { background-position: 0 -16px; } .icons-twitter { background-position: 0 -32px; } .icons-xing { background-position: 0 0; }
  • 25. Informations ● Sass - sass-lang.com ● Sass Ruby on Rails Implementation github.com/rails/sass-rails ● Compass - compass-style.org ● Noch mehr Infos ○ 35 Great Resources for Compass and Sass ○ Sass & Compass: The future of stylesheets now ○ css2sass converter