Input Add-ons

Because of the way input sizing works in CSS, it’s almost impossible to append or prepend another element to it and have the input field behave fluidly and take up the remaining space.

The only existing way to do this is to either know the exact width of the input, or to use something like display:table-cell, which has its own set of problems, most notably the difficulty with positioning anything absolutely inside of the add-on in certain browsers.

With Flexbox, all these problems go away, and the code is trivially simple. In addition, you get the input field and the input add-on to be the same height for free.

input-add-ons


source

Top 20 Secrets of Coda 2

Great collection of tips for using Coda 2.

  1. Open A New File in a Split
  2. Use the Golden HTML + CSS + Live Preview Setup
  3. Explore the Preferences
  4. Create Site Groups
  5. Use Text Tabs
  6. Hide or Show Specific File Types
  7. Preview in a Simulated iPhone/iPad
  8. Access the Code Navigator in the Path Bar
  9. Add Custom Bookmarks to the Navigator
  10. Quickly Jump to Line
  11. Discover the Books
  12. Browse CSS Styles Inline
  13. Preview in a New Window
  14. Quickly Wrap Text in a Tag
  15. Blockedit Multiple Lines at Once
  16. Use Quick Open
  17. Discover the Text Processing Menu
  18. Drag Your Favorite Folders to Places
  19. Quickly Jump to CSS in Preview
  20. Bonus Tip: Customize Keyboard Shortcuts

coda2-splits


source

A List Apart: A Vision for Our Sass

One well-documented abuse of Sass’s feature-set is the tendency to heavily nest our CSS selectors. Now don’t get me wrong, nesting is beneficial; it groups code together to make style management easier. However, deep nesting can be problematic.

One option is to create rules that act as limits and reign in some of that power. For example, Mario Ricalde uses an Inception-inspired guideline for nesting: “Don’t go more than four levels deep.”

Rules like this are especially helpful for newcomers, because they provide clear boundaries to work within. But few universal rules exist; the Sass spec is sprawling and growing (as I write this, Sass is at version 3.4.5). With each new release, more features are introduced, and with them more rope with which to hang ourselves. A rule set alone would be ineffective.

source

BEM and SMACSS: Advice From Developers Who’ve Been There

Block represents an object in your website. For example:

  • a person
  • a login form
  • a menu
  • a search form

An Element is a component within the block that performs a particular function. It should only make sense in the context of its block. For example:

  • a hand
  • a login button
  • a menu item
  • a search input field

Modifier is how we represent the variations of a block. For example:

  • a female person
  • a condensed login form (e.g. we’re hiding the labels in one version)
  • a menu modified to look differently for a footer or sitemap
  • a search input field with a particular button style

what is BEM css


source

Tuts+: How We’re Using Modules to Organize Our Front-End Code

…[W]e adopted an approach to CSS based on the BEM methodology. Instead of defining styles which apply globally, all styles are siloed into self-contained “blocks” by way of a naming convention. A “block” is defined, more or less, as a single free-standing unit of content that is potentially reusable (although it’s not mandatory that it actually be reused).

For example, let’s take a look at the “featured-sections” block:

Tuts Featured Sections Block

According to our naming convention, this block has a root div element with the class name featured-sections. It contains elements with class names such as featured-sections__title and featured-sections__section-link.

We’re using a matching naming convention for our source code, as such all the styles for this featured-section block are stored in modules/featured_section.sass:

This naming convention ensures that styles no longer conflict and intermingle. As long as our naming convention is followed, with the block name at the start of each class name, it’s impossible for a style to affect something outside of its own block.

It also makes it super easy to work out where to look in the codebase for the styles corresponding to an element. You can simply look at the element’s class name, and you’ll know the name of the stylesheet to open.

source

A Bulletproof Guide to Using HTML5 and CSS3 in Email

HTML email

Using HTML5 and CSS3 in email doesn’t have to be difficult. It doesn’t require endless hours of troubleshooting in quirky email clients (we’re looking at you, Outlook). All it takes is the proper framework to quickly implement HTML5 and CSS3 without the hassle or fear of running into rendering problems. And, lucky for you, we have that framework!

Here is the single greatest line of code ever made for email designers and developers:

@media screen and (-webkit-min-device-pixel-ratio:0) {
  /* Insert styles here */
}

This media query only targets WebKit-supported email clients—which have incredible support for HTML5 and CSS3. This media query allows you to use of modern techniques like HTML5 video, CSS3 animation, web fonts, and more.

This approach also splits email development for modern email clients and older clients in two. You can use Safari/Chrome to test and develop modern techniques for WebKit-supported clients while using Firefox for your baseline experience for older clients like Outlook.

source