liz
liz

Reputation: 49

styling rails form_tag in css

I have a form_tag where I want to style the field tags and the borders around the field tag. this is my code so far:(I'm really new to rails btw)

<div class="login">
<%= form_tag("/login", method: "post") do %>   
  <%= label_tag(:email) %>   
  <%= email_field_tag(:email) %>
  <%= label_tag(:password) %>   
  <%= password_field_tag(:password) %>
 <%= submit_tag("Log In") %> 
<% end %>

css code: 
.login {
  display: inline-block;
  margin-left: 450px;
}

Upvotes: 1

Views: 2988

Answers (1)

Rick Runyon
Rick Runyon

Reputation: 4354

The docs for form_tag show that it takes an options hash as its second argument. Any provided option not listed in the docs will create a standard HTML attribute for the tag.

Give this a try:

<%= form_tag("/login", method: "post", class: "my_class") do %>  

Upvotes: 4

Related Questions