background preloader

Sass vs. LESS

Sass vs. LESS
"Which CSS preprocessor language should I choose?" is a hot topic lately. I've been asked in person several times and an online debate has been popping up every few days it seems. It's nice that the conversation has largely turned from whether or not preprocessing is a good idea to which one language is best. Let's do this thing. Really short answer: Sass Slightly longer answer: Sass is better on a whole bunch of different fronts, but if you are already happy in LESS, that's cool, at least you are doing yourself a favor by preprocessing. Much longer answer: Read on. The Much Longer Answer The Learning Curve with Ruby and Command Line and Whatever The only learning curve is the syntax. Winner: Nobody Helping with CSS3 With either language, you can write your own mixins to help with vendor prefixes. In Sass, you can use Compass, and Compass will keep itself updated, and thus the prefix situation is handled for you. In LESS, there are also some mixin libraries battling to be the best. See that?

Sassaparilla: Sass & Compass Grid System Sass: CSS Pre-Processsor Before you can use Sass, you need to set it up on your project. If you want to just browse here, go ahead, but we recommend you go install Sass first. Go here if you want to learn how to get everything set up. PreprocessingPreprocessing permalink CSS on its own can be fun, but stylesheets are getting larger, more complex, and harder to maintain. Once you start tinkering with Sass, it will take your preprocessed Sass file and save it as a normal CSS file that you can use in your website. The most direct way to make this happen is in your terminal. You can also watch individual files or directories with the --watch flag. sass --watch input.scss output.css You can watch and output to directories by using folder paths as your input and output, and separating them with a colon. sass --watch app/sass:public/stylesheets Sass would watch all files in the app/sass folder for changes, and compile CSS to the public/stylesheets folder. 💡 Fun fact: Sass has two syntaxes! VariablesVariables permalink

LESS « The Dynamic Stylesheet Language Initializr - Start an HTML5 Boilerplate project in 15 seconds! Initializr: With Great Templates Comes Great Responsivity! | @verekia's blog Today I'm proud to announce that a "Responsive template" is now available on Initializr! It will help you dealing with all the various devices used to display your site. Mobiles, tablets, netbooks, laptops, desktop monitors, HUGE desktop monitors... Making your site work correctly on all these devices is a real nightmare. Well guess what? About responsive web design For those who have been living in a cave for the last few months (understand: for those who have a life and don’t spend days reading tweets and blogs) you probably need a short update about what a "responsive" design is. To design a responsive layout, we have to forget about the usual static 960px width layouts and go fluid with percentage widths and media queries. A fluid layout with percentage widths The first thing our page needs is a "fluid" layout. Mobile-first approach media queries The mobile view Here is the very simple mobile display of the responsive template. The intermediate view The wide view The maximum-width view

DomainTools PxLoader | A Simple JavasScript Preloader A JavaScript Preloader for HTML5 Apps PxLoader is a Javascript library that helps you download images, sound files or anything else you need before you take a specific action on your site (like showing a user interface or starting a game). You can use it to create a preloader for HTML5 games and websites. It let's you monitor download status by providing progress and completed events and it lets you prioritize the order in which items are downloaded. You can even tag groups of files and then prioritize downloads or register for events by tag. We created PxLoader for the HTML5 version of Cut the Rope and out of the box works great with images and sound files (the types of resources we needed for the game), but it's designed to be extensible and work with any file type or other network action. Step by Step Instructions 1. *The sound file downloader works with SoundManager 2 and allows it do the heavy lifting of the actual download. 2. 3. Download Images Before Drawing to a Canvas add(resource)

GoJS GoJS is the only diagram library for HTML5 Canvas that supports data binding and templates. GoJS integrates these concepts cleanly and coherently into a powerful diagramming extension to the HTML5 JavaScript environment. Diagram Models and Data Binding One of the principal features of the Model-View-ViewModel design pattern is the use of data binding. There are at least two kinds of relationships that a diagram can support between data items: Relationships forming a graph of nodes and links (or in similar terminology: nodes and arcs, or entities and relationships, or vertices and edges) Grouping relationships, where a group contains members; perhaps for part/sub-part containment, or for the nesting of subgraphs GoJS makes use of a model to discover, maintain, navigate, and modify these relationships based on the data to which the diagram is bound. If you look at our online demos, you will see how little code you need to visualize and update your data. Will result in this diagram:

Slider for Bootstrap, from Twitter Example Basic example with custom formater Range selector, options specified via data attribute. Filter by price interval: € 10€ 1000 Using events to work with the values and style the selection and handles via CSS. Vertical sliders Using bootstrap-slider.js Call the slider via javascript: $('.slider').slider() Options Markup You can use data attributes to set up the configuration. Methods .slider(options) Initializes a slider. .slider('getValue') Get the value. .slider('setValue', value) Set a new value. Events Slider class exposes a few events for manipulating the value. $('#dp5').slider() .on('slide', function(ev){ .... }); Datepicker for Bootstrap, from Twitter Example Attached to a field with the format specified via options. Attachet to a field with the format specified via data tag. As component. Start with years viewMode. Limit the view mode to months Attached to other elment then field and using events to work with the date values. Disabling dates in the past and dependent disabling. Using bootstrap-datepicker.js Call the datepicker via javascript: $('.datepicker').datepicker() Options Markup Format a component. Methods .datepicker(options) Initializes an datepicker. .datepicker('show') Show the datepicker. .datepicker('hide') Hide the datepicker. .datepicker('place') Updates the date picker's position relative to the element .datepicker('setValue', value) Set a new value for the datepicker. Events Datepicker class exposes a few events for manipulating the dates. $('#dp5').datepicker() .on('changeDate', function(ev){ if (ev.date.valueOf() < startDate.valueOf()){ .... } });

Position y Float El valor predeterminado para todos los elementos es position:static, que posiciona al elemento según el lugar donde fue definido en el HTML. Por lo general no hay necesidad de definir position:static, a menos que querramos caerle encima a alguna regla anterior que haya modificado el posicionamiento. Si le definimos position:relative a un elemento, entonces podemos utilizar top, bottom, left y right para mover el elemento con relación a la posición en la que aparecería normalmente en el documento. Movamos el div-1 20 pixeles hacia abajo y 40 pixeles hacia la izquierda: Fíjate que en el lugar donde hubiese aparecido el div-1 ahora hay un espacio en blanco. Parecería que position:relative no es muy útil, pero tendrá una tarea muy importante más adelante. Cuando utilizamos position:absolute, el elemento es removido del documento y colocado exactamente donde nosotros queremos. Movamos el div-1a a la esquina superior derecha de la página: Un momento, ¿qué sucedió con los demás elementos?

Related: