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 3243750
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:28:12+00:00 2026-05-17T18:28:12+00:00

I have a title on a blog goes like this Main Idea, key term,

  • 0

I have a title on a blog goes like this Main Idea, key term, key term, keyterm

I want the main idea and the key terms to have a different font sizes. First thing that came to mind was to search for the first comma and the end of the string and replace that chunk with the same thing but surrounded by span tags with a class to make the font smaller.

Here is the plan:

HTML (before)

  <a href="stupidreqexquestion">Main Idea, key term, key term, key term</a>

HTML (after)

  <a href="stupidreqexquestion">Main Idea <span class="smaller_font">, key term, key term key term</span></a>

I’m using Rails so I plan to add this as a helper function – for ex:

helper

  def make_key_words_in_title_smaller(title)
      #replace the keywords in the title with key words surrounded by span tags
  end 

view

  <% @posts.each do |post |%>
      <%= make_key_words_in_title_smaller(post.title)%>
  <% end -%>
  • 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-05-17T18:28:12+00:00Added an answer on May 17, 2026 at 6:28 pm

    If you don’t care about the Main Idea part being "Welcome home, Roxy Carmichael", that is, with a comman within double quotes

    >> t = "Main Idea, key term, key term, key term"
    => "Main Idea, key term, key term, key term"
    
    >> t.gsub(/(.*?)(,.*)/, '\1 <span class="smaller_font">\2</span>')
    => "Main Idea <span class=\"smaller_font\">, key term, key term, key term</span>"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get a url structure like this. http://example.com/blog/1/title-name-goes-here My main urls
I want to have my title tag look like this: My Website - Name
I have URL scheme for my blog like this: http://www.example.com/%YEAR%/%MONTH%/%CATEGORY%/%POST_TITLE%/ Now i want to
I want to format the posts on a blog to have stacking 'title divs'
For example, I can have documents like: doc1 = { title: First blog post,
I have a code that goes like this on HTML: <div class=blog_highlight> <ul class=calendar>
I have a title (h1) which is centered on the page. I want to
At the top of my page I want to have the title of the
I would like to make every EditText object have own title like in Pure
Say I have a URL for an article: http://domain.com/blog/articles/title-here/ And it has about 5

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.