0

Here are the original codes :

 <img src="images/title3.gif"  style=" display: block;
margin-left: auto;
margin-right: auto "></img>

Now I make it to :

    <%= image_tag("title3.gif", ) %>

I don't want to put on the stylesheets folders .Can I do it ?

3
  • It's a bit unclear what the question is. What are you trying to do? Commented Apr 20, 2017 at 12:13
  • @Iceman I want to write the style content with the image_tag Commented Apr 20, 2017 at 12:15
  • Adding style attributes to HTML tags is IMHO a code smell. Why don't you add the styles to a CSS file? Commented Apr 20, 2017 at 12:25

1 Answer 1

2

There is an option style:

image_tag("title3.gif", style: "display: block; margin-left: auto; margin-right: auto;")
Sign up to request clarification or add additional context in comments.

1 Comment

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.