# How to CSS

**URL:** <https://www.ruby-forum.com/t/how-to-css/192649>\
**Category:** Rails\
**Created:** [August 3, 2010, 5:46pm UTC](https://www.ruby-forum.com/t/how-to-css/192649 "2010-08-03T17:46:37Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [August 3, 2010, 5:46pm UTC](https://www.ruby-forum.com/t/how-to-css/192649/1 "2010-08-03T17:46:37Z")

</div>

Hi,

It’s not specifically related to Rails, but how do you arrange your CSS  
files?

I used to dump everything in a gigantic screen.css file. Then I noticed  
that some rules only appeared in a few pages.

Therefore I am considering having a layout.css for all pages and roughly  
1 css file per controller if I need specific things in it that are not  
found in layout.css.

How do you organize that?

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [August 3, 2010, 5:54pm UTC](https://www.ruby-forum.com/t/how-to-css/192649/2 "2010-08-03T17:54:29Z")

</div>

Fernando P. wrote:

> Hi,
> 
> It’s not specifically related to Rails, but how do you arrange your CSS  
> files?
> 
> I used to dump everything in a gigantic screen.css file. Then I noticed  
> that some rules only appeared in a few pages.
> 
> Therefore I am considering having a layout.css for all pages and roughly  
> 1 css file per controller if I need specific things in it that are not  
> found in layout.css.
> 
> How do you organize that?

The latter way. I also _highly_ recommend using Sass: CSS alone is not  
powerful enough to fully separate content from presentation in a  
maintainable way – Sass’ higher-level abstractions are necessary here.

## Best,

Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [August 3, 2010, 6:42pm UTC](https://www.ruby-forum.com/t/how-to-css/192649/3 "2010-08-03T18:42:32Z")

</div>

> > How do you organize that?
> 
> The latter way.

Ok.

> I also _highly_ recommend using Sass: CSS alone is not  
> powerful enough to fully separate content from presentation in a  
> maintainable way – Sass’ higher-level abstractions are necessary here.

I find sass “ugly”, and I reviewed “less”, but in the end I stayed with  
pure css.

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [August 3, 2010, 7:00pm UTC](https://www.ruby-forum.com/t/how-to-css/192649/4 "2010-08-03T19:00:32Z")

</div>

On Tue, Aug 3, 2010 at 12:42 PM, Fernando P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > > How do you organize that?
> > 
> > The latter way.
> 
> Ok.

Also, take a look at  
[Progressive Enhancement with CSS – A List Apart](http://www.alistapart.com/articles/progressiveenhancementwithcss). The  
article recommends ways for splitting up your CSS.

---

<div class="post-metadata">

**Author:** ![fipa](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/f/9e8a1a/32.png) [@fipa](https://www.ruby-forum.com/u/fipa)\
**Post date:** [August 3, 2010, 7:02pm UTC](https://www.ruby-forum.com/t/how-to-css/192649/5 "2010-08-03T19:02:29Z")

</div>

Fernando P. wrote:

> > > How do you organize that?
> > 
> > The latter way.
> 
> Ok.
> 
> > I also _highly_ recommend using Sass: CSS alone is not  
> > powerful enough to fully separate content from presentation in a  
> > maintainable way – Sass’ higher-level abstractions are necessary here.
> 
> I find sass “ugly”, and I reviewed “less”, but in the end I stayed with  
> pure css.

That is a bad idea. You should learn Sass well enough to be able to use  
it to clean up your markup. If you’re using plain CSS, you’re working  
too hard.

I’ve noticed that you tend to disparage tools outside a fairly narrow  
comfort zone, even when those tools could materially help you. May I  
suggest broadening your horizons a bit?

Best,  
–Â  
Marnen Laibow-Koser  
[http://www.marnen.org](http://www.marnen.org)  
removed\_email\_address@domain.invalid

Sent from my iPhone
