-
Notifications
You must be signed in to change notification settings - Fork 191
Style Guide: HTML (ERB)
Matt Budz edited this page Mar 30, 2023
·
3 revisions
All HTML files are located in app/views/
.
Please also refer to the Accessibility Guidelines
Once you have your instance running, navigate to localhost:3000/project/1/styles
for examples of code snippets.
- Use semantic HTML/ERB elements (header, main, section, article, aside, footer, etc).
- Ensure that all DOM IDs are unique. Exercise extra care when building out elements using Rails loops or partials repeatedly loaded via AJAX.
- In order for images to correctly display in both development and production environments, rather than using a standard HTML image tag:
<img src="/assets/image.png>
- Use a rails image tag without the assets directory:
<%= image_tag 'image.png' %>
- When using an anchor tag with a link to direct a user elsewhere, do not use a standard HTML
<a>
tag:
<a href="/some-path/">Click Here</a>
Use a rails link tag:
<%= link_to 'Click Here', some-path %>