Are those classes built-in?

At: Getting Started with Rails — Ruby on Rails Guides

You can see the following for example in /app/views/posts/show.html.erb

. . <div class="field">     <%= f.label :body %><br />     <%= f.text_area :body %>   </div>   <div class="actions">     <%= f.submit %>   </div> . .

Regarding:

<div class="field"> <div class="actions">

Are those classes built in Rails? Such that we don't have to define them like we do when building an HTML/CSS website?

Thanks.

Abder-Rahman Ali wrote:

At: Getting Started with Rails — Ruby on Rails Guides

You can see the following for example in /app/views/posts/show.html.erb

. . <div class="field">     <%= f.label :body %><br />     <%= f.text_area :body %>   </div>   <div class="actions">     <%= f.submit %>   </div> . .

Regarding:

<div class="field"> <div class="actions">

Are those classes built in Rails? Such that we don't have to define them like we do when building an HTML/CSS website?

Instead of asking, take a look through whatever CSS is getting included. That will answer your question.

Thanks.

Best,

Thanks.

Hey, a question I can answer! :slight_smile:

Those aren't ruby classes as you're probably thinking about. They're css classes and (from my limited knowledge of css) basically control the presentation of the text in between the tags.

I'd look in the css file for "field" to see how it's being presented (font, color, size, etc)

Abder-Rahman Ali wrote:

I have created a "main.css", and referred to it in "application.html.erb" as follows:

<%= stylesheet_link_tag "main" %>

But, in my "main.css" there is NO "field" class.

don't you think it is built in Rails itself?

Have a look in scaffold.css which was made by the scaffold generator.

Colin

Colin Law wrote:

Do you mean that class field is not defined in scaffold.css? I am not using Rails 3 so I cannot confirm this but I would be surprised if it is not there. If not then just put whatever style you want for that class in your own stylesheet.

Colin

I'm using Rails 3. And, as mentiond I don't have "scaffold.css", and have "main.css".

In your original post you said you are working from Getting Started with Rails — Ruby on Rails Guides. In section 6 it says that the scaffold generator will build 15 files, including scaffold.css. Did it not build that file for you when you ran the scaffold?

Colin

Colin Law wrote:

I'm using Rails 3. And, as mentiond I don't have "scaffold.css", and have "main.css". --

In your original post you said you are working from Getting Started with Rails — Ruby on Rails Guides. In section 6 it says that the scaffold generator will build 15 files, including scaffold.css. Did it not build that file for you when you ran the scaffold?

Colin

It actually did build "scaffold.css".

The case is I have created another application and entered a custom "main.css" and wondered how the classes still work while the stylesheet that contains its classes is not there.

Also, I think I may have had to enter the question regarding the customized css in another thread.

Thanks.

It would have saved a lot of time if you had said that in the first place. :slight_smile:

What do you mean by 'the classes still work'? There is no need for a class to have a css entry, the data will still be displayed, using whatever is the current style at that point in the page.

Colin

Got you, thanks.