Thank you for your help.I'm a beginner at rails.I'm creating a recipe app with rails4.
I would like to list the contents stored in the model side by side on the index page.
How should I arrange it?
Currently, I only understand .each loop, and they are lined up vertically.
<Current code: index.html.erb>
<%@recipes.each do |recipe|%>
<%=link_to recipe do%>
<%=image_tag recipe.image.url(:thumb)%>
<%end%>
<h2><%=link_to recipe.title, recipe%>/2>
Thank you for your cooperation.
ruby-on-rails html css
I think there are many ways, but I will post a sample using flexbox.
https://codepen.io/itmammoth/pen/mpewWa
Please edit erb to output html like this.
Search flexbox for more information such as margins and alignment.
The H tag has a headline, so I don't think it's appropriate to use it for elements that you want to line up horizontally like the layout you want.
"Would it be possible to set up a table and output ""image column"" and ""cooking name column"" in order?"
915 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
613 GDB gets version error when attempting to debug with the Presense SDK (IDE)
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
573 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.