Object Oriented CSS Creative Director Deeson Online twitter.com/graemeblackwood Graeme Blackwood.

Slides:



Advertisements
Similar presentations
Bending Zen Intro Using Zen Themes functionality, but bending it into your own theme.
Advertisements

HAML/SASS and tenplate building clean semantic sites for less.
HTML Basics Customizing your site using the basics of HTML.
Become a Panels Rockstar. Audience Survey Have you tried Panels? Are you a …. –Themer / Designer? –Developer / Code Junkie? –Information Architect?
DOMINATE THE THEME LAYER August 21st.. Jesper Wøldiche Rahkonen Themer / architect at Bysted. Markup Marine / Journalist / Frontend United
Cascading Style Sheets
FORMATTING IN CONTEXT. FOLLOW UPS ANCHOR POINTS MUST BE UNIQUE  If you have more than one, how does it know where to go?  They can be repeated across.
“Cascading Style Sheets” for styling WWW information DSC340 Mike Pangburn.
XHTML & CSS 2 By Trevor Adams. Last week XHTML eXtensible HyperText Mark-up Language The beginning – HTML Web Standards Concept and syntax Elements (tags)
Bootstrap & CSS James Kahng. Intro Websites require a lot of upfront setup to look passably good (HTML base, CSS style, etc.) Because of this, people.
Murach’s ASP.NET 3.5/C#, C5© 2008, Mike Murach & Associates, Inc.Slide 1.
Cascading Style Sheets Scripting with Style. CSS versus HTML  Ways to format in HTML –HTML Tag extensions –Converting Text to images –Page Layout with.
Art 128 Interface Programming 1 In-class Presentation Week 11B.
Responsive Web Design Nuts & Bolts David Weedon - UI/UX Designer, Covenant Technology Partners.
CSS (Cascading Style Sheets): How the web is styled Create Rules that specify how the content of an HTML Element should appear. CSS controls how your web.
Web Page Layout With CSS CSS Level 2 vs. Nested Tables Mike Wallick – 11/3/04.
Cascading Style Sheet. What is CSS? CSS stands for Cascading Style Sheets. CSS are a series of instruction that specify how markup elements should appear.
TOP 20 MISTAKES YOU WILL MAKE IN YOUR 1ST DRUPAL PROJECT IZTOK SMOLIČ, ZAGREB.
Chapter 4 Dreamweaver: Part II The Web Warrior Guide to Web Design Technologies.
Adapting a Site Template Using Drupal Themes and SASS/LESS.
Multimedia & The World Wide Web winny HCI 201 Multimedia and the www.
With your friendly Web Developer, Chris.. Terminology  HTML - > Hypertext Markup Language  CSS -> Cascading Style Sheet  open tag  close tag  HTTP->Hypertext.
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
Basics of Smarajit Dasgupta.
INTRODUCTION TO HTML5 CSS Styles. Understanding Style Sheets  HTML5 enables you to define many different types of content on a web page, including headings,
CSS Sprites. What are sprites? In the early days of video games, memory for graphics was very low. So to make things load quickly and make graphics look.
INTERNAL CSS Casey Ames Different types of CSS There are three different types of CSS: ◦ External CSS ◦ Internal CSS ◦ Inline CSS In this presentation.
Basic Responsive Design Techniques. Let’s take a look at this basic layout. It has a header and two columns of text, in a box that is centered on the.
I NTRO TO CSS IAT100 Spring I NTRO TO CSS Covered in this lesson: Overview What is CSS? Why to use CSS? CSS for Skinning your Website Structure.
WRT235: Writing in Electronic Environments CSS Classes, IDs, divs.
Cascading Style Sheets Orientation Learning Web Design: Chapter 11.
 cascade Style Sheets (CSS) is a mark-up language that was first proposed in 1994 by Håkon Wium Lie. CSS works in conjunction with HTML to greatly increase.
SCALING CSS (FOR LARGE WEB SITES) Tips, best practices and recommended methodologies for organizing and managing CSS for large web sites.
Essentials of HTML Class 4 Instructor: Jeanne Hart
Cascading Style Sheets Part 1. CSS vs HTML HTML: Originally intended to markup structure of a document (,...,,,,,...) CSS Developing technology, CSS1,
Css. Definition Cascading style sheet (CSS)  It is a simple mechanism for adding style (e.g. fonts, colors, spacing) to Web documents.
Daveandal.net Cascading Style Sheets 101 “How I learnt to love CSS and found my inner designer”
Use CSS to Implement a Reusable Design Selecting a Dreamweaver CSS Starter Layout is the easiest way to create a page with a CSS layout You can access.
CSS BEST PRACTICES.
INTRODUCTION TO CSS. TOPICS TO BE DISCUSSED……….  Introduction Introduction  Features of CSS Features of CSS  Creating Style Sheet Creating Style Sheet.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
A really fairly simple guide to: mobile browser-based application development (part 2, CSS) Chris Greenhalgh G54UBI / Chris Greenhalgh
| imodules.com HTML Best Practices: The Key to a Successful Starts with the Template Presented by Chris Smith, Manager of Design.
SASS & LESS Syntactically Awesome StyleSheets Dynamic StyleSheet Language Svetlin Nakov Technical Trainer Software University
1 CSS-PREPROCESSORS as a way to speed up the process of interfaces developing and achieve Customer goals DMITRY SHURSHILIN AUGUST 3, 2015.
Cascading Style Sheets CSS.  Standard defined by the W3C  CSS1 (released 1996) 50 properties  CSS2 (released 1998) 150 properties (positioning)  CSS3.
Introduction to CSS. Why CSS? CSS Provides Efficiency in Design and Updates CSS relatively easy to use Can give you more flexibility and control Faster.
Drupal Theming Chris Neglia and Lisa Forgan Copyright 2009, Page 1 Solutions.
Web Design (12) CSS Introduction. Cascading Style Sheets - Defined CSS is the W3C standard for defining the presentation of documents written in HTML.
CSS Cascading Style Sheets A very brief introduction CSS, Cascading Style Sheets1.
Microsoft Expression Web 3 – Illustrated Unit D: Structuring and Styling Text.
CSS IS A LANGUAGE DESIGNED TO TARGET HTML ELEMENTS AND NODES BY TYPE, CLASS, ID AND VALUE, AND CHANGE THEIR VALUES CSS – change how your HTML looks and.
Group 9: Through examples, explain how to build a css navigation bar. Presented by: Daniel Ku, Matt Iannacci & Iphia Henry.
Understanding CSS Cascading Style Sheets control the presentation of content in HTML pages Style Sheets separate formatting from the content –Styles defined.
CSS Layout Cascading Style Sheets. Lesson Overview  In this lesson, we’ll cover:  Brief CSS review  Creating sections with the tag  Creating inline.
Fundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Textbook to be published by Pearson Ed in early Bootstrap.
HTML 5 AND CSS Dr Mohd Soperi Mohd Zahid Semester /16.
HTML LAYOUTS. CONTENTS Layouts Example Layout Using Element Example Using Table Example Output Summary Exercise.
What is CSS? A set of style rules that tell the web browser how to present a web page or document. – In earlier versions of HTML, style characteristics,
>> CSS Layouts. Recall Properties of Box – Border (style, width, color) – Padding – Margin – Display – Background – Dimension Welcome Padding Area Border.
Creating a Theme From Scratch in Drupal
>> Introduction to CSS
Creating a Baseline Grid
CSS BEST PRACTICES.
HTML / CSS Mai Moustafa Senior Web Designer eSpace eSpace.
Session IV Chapter 20 - How to use SASS and Less
Bootstrap Direct quote from source: bootstrap/
Presentation transcript:

Object Oriented CSS Creative Director Deeson Online twitter.com/graemeblackwood Graeme Blackwood

Graeme Blackwood Creative Director, Deeson Online Graeme Blackwood Creative Director, Deeson Online

Object Oriented CSS

Props Nicole Sullivan, Jonathan Snook (SMACSS), Everyone at Chris Eppstein, Kevin Poulton And loads more!

Some misconceptions

OO CSS != OO Programming But an OOP mindset can be applied to CSS OO CSS != OO Programming But an OOP mindset can be applied to CSS

OOCSS does not require any newer technologies It works in IE6 – no need for CSS3, HTML5 etc OOCSS does not require any newer technologies It works in IE6 – no need for CSS3, HTML5 etc

Semantic markup is very helpful, but usually not essential Semantic is better though! Semantic markup is very helpful, but usually not essential Semantic is better though!

The traditional approach to CSS

Style output as needed Each item / page individually...

Target styles by drilling down through nested elements

Problems with traditional CSS

Coding takes a lot longer

It gets bloated

It is difficult to read and hard to reuse

Traditional CSS is tough to maintain

Object Oriented CSS A new way of thinking

Separate layout from theme (Use a grid system!)

Separate the container from the content

Look for shared styles You will see them everywhere

Why should I care?

Reusable code

Faster development Less effort to code

Easier to maintain

Less code, smaller files

Getting started

Using a grid system? You are already on the right track!

Use a reset stylesheet HTML5 boilerplate’s normalize.css

Set good base styles To minimise later overrides * {box-sizing: border-box} is pretty handy

Set good base styles To minimise later overrides Build HTML prototypes with Drupal in mind...

Clean up what Drupal throws at you Don’t just style, theme!

Lose unnecessary markup if it affects you Some divs are totally pointless!

PHP code not for you? I find Drupal modules like Display Suite and Skinr helpful

Check out TWIG We’re working on making Drupal 8 a lot easier to theme. Check out TWIG We’re working on making Drupal 8 a lot easier to theme.

Don’t be too obsessed with perfect markup Just enough is ok

“Now, this is just a simulation of what the blocks will look like once they’re assembled”

Let’s look at some real world applications...

.block = inherited base styles only.grid-4 = grid class.theme-a = theme class, H3 and p inherit colour.padded is a class I add to the grid framework for situations like this

Block title Hello world!.grid-4 comes from your grid framework.theme-a { background-color: #580174; border-radius: 6px; color: #fff; //H3 and p inherit this }

Carousel nav tabs Object is a Drupal menu – UL with a class of.sidebar-menu. Custom jQuery targets the ID.

Also used on a listing And it flexes to the container

99% of the styles are reused, targeted through.right.sidebar-menu only to flip the active item

Carousel items With a class of.product-box

Reused on listing pages

Same layout as product listings and carousel, flexed to image size

What about SASS and LESS? Why bother with presentational classes in markup anymore?

Not everyone wants to use a CSS preprocessorAnd the mindset of reduce, reuse & recycle is just as important even with one

Use SASS wisely – it’s another layer to debug

Be particularly careful with nested selectors cascade cascade Be particularly careful with nested selectors cascade cascade

Disregarding the other principles of OOCSS may create pain later You could end up with generated CSS bloated even more than if you had hand-coded it

Summary OOCSS is as much a mindset as a technique The principles are to reduce, reuse and recycle code This is done through separating layout from theme and the container from the content It relies primarily on reused classes and markup We are working on Drupal 8 to make it much easier to change markup. In the meantime, try Display Suite or Skinr for node theming OOCSS is as much a mindset as a technique The principles are to reduce, reuse and recycle code This is done through separating layout from theme and the container from the content It relies primarily on reused classes and markup We are working on Drupal 8 to make it much easier to change markup. In the meantime, try Display Suite or Skinr for node theming

Summary CSS preprocessors like SASS and LESS are great But they create another layer to debug And the code they generate can be very bloated Preprocessors are not an excuse to be lazy They still need to be used with an OO mindset CSS preprocessors like SASS and LESS are great But they create another layer to debug And the code they generate can be very bloated Preprocessors are not an excuse to be lazy They still need to be used with an OO mindset

Спасибо за внимание Вопросы? Creative Director Deeson Graeme Blackwood

@graemeblackwood Вопросы? Спасибо за внимание Most of the fantastic lego images were by Kevin Poulton