Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How do you code?

Featured Replies

I've recently started gearing my code more towards SMACSS and OOCSS but in doing so it's opened up a can of worms. I've had all kinds of ideas on how best to structure CSS and CSS related HTML. For example I've started using a lot more classes to isolate different elements for a) potential reuse and b.) avoidance of potential clashes with other elements, e.g. using one class for many elements is eventually going to force you to overwrite that class whereas having specific classes means you give each element its' own styling.

 

I'm currently thinking about devoting a section of my CSS purely to any structural element that could potentially be reused. So instead of a promotion box layout and styling going under a page section it would simply go under something like /* Promo box A */ so that the tags could simply be reused not only across a specific site but any site in the future.

 

Anyway to my point, I wondered if anyone else was thinking along these lines or if anyone has any other interesting/useful ways to structure CSS?

Edited by jtuds

I adore SMACSS, it changed the way I write CSS more-or-less overnight. So welcome to the winning team :)

 

In terms of ordering, there's no shame in creating structural classes and using them in several places on your page. I tend to find that I don't need many though, I usually have one for floated elements with a container that wraps them, absolutely positioned children in a relatively positioned parent and lists without bullets. I find that they solve most of my woes and anything more unique (such as a set width) becomes it's own module.

 

I also tend to create my CSS gradients as a module to handle some of the intricacies, and CSS animations are a module to get as much browser support as possible.

 

I have a base style sheet that I use whenever I start, you're welcome to take a look. It's on my Gist.

 

I hope that helps answer your question

I began using SASS only yesterday. That is definatley going to speed my up, I have wanted to be able to use variables in CSS for a long while now.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.