Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8821311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:49:18+00:00 2026-06-14T05:49:18+00:00

In my HTML I have a span <span style=color:#??????> <h3>Title</h3> </span> Okay, in my

  • 0

In my HTML I have a span

<span style="color:#??????>
    <h3>Title</h3>
</span>

Okay, in my database I have records which have a field that store the hash color value of a span, example #123456 , with the hash included.

Now what I want to do is in the HTML, instead of me specifying the colour, it is retrieved directly from the database.
The model is called Sauce. The field is called title_colour.

I have tried:

<span style="color: #{sauce.title_colour}">...</span>

The problem is that when the HTML is output, it is exactly as it is in the code. It does not extract the database value.

I think the problem is because in Rails when we display an object when already in quote marks, we start with a #, eg #{sauce.field_name} , and in CSS the color value also starts with a #.
Any help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T05:49:19+00:00Added an answer on June 14, 2026 at 5:49 am

    You need to use the proper erb interpolation tags:

    <span style="color: <%= sauce.title_colour %>">...</span>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some html snippet <div id=title>This is title<span id=close>X<span><div> The width of this
I have this HTML code which simulates a dropdown multi-checkbox <div> <div class=select> <span>Select
If I have the HTML below: <div style=display:none;> <span id=hello>Hey</span> </div> And I do
Say I have this HTML fragment <td width=25% style=text-align:right; > <span style=font-family: Arial; font-size:
I have the following HTML code: <ul class=blogEntry> <li class=title section> <span><asp:Literal ID=litTitle runat=server
<html> <head> <title>Coupon test code</title> <style> #error{ color: red; font-weight: bold; } </style> </head>
I have the following HTML: <div class=title> <span>Cumulative performance</span> <span>20/02/2011</span> </div> with this CSS:
Like the title says, I want to have a HTML table that allows its
I have HTML code like this: <asp:LinkButton ID=AddButton runat=server OnClick=AddPatientBtn_Click> <span class=Normal>Add</span> </asp:LinkButton> I
This is the html I have: <div id=social> <a href=# class=twitter><span class=text>Twitter</span></a> </div> What

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.