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

  • Home
  • SEARCH
  • 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 8747517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T12:22:07+00:00 2026-06-13T12:22:07+00:00

Right now i am using multiple heading tags and a css class to achieve

  • 0

Right now i am using multiple heading tags and a css class to achieve the effect shown in the image below, Is there any way to achieve this by using just a single heading/line and css?

Current Code :

<h2 class="heading">Hi guys, How can i achieve this effect using just a single</h2>
<div class="clearfix"></div>
<h2 class="heading">line of text and css. Right now i am using</h2>
<h2 class="heading">multiple &lt;h2&gt; tags and a css class to achieve this effect.</h2>
<h2 class="heading">Is it possible to achieve this only with css or do i have to use Javascript as well?</h2>

Expected Code

<h2 class="heading">Hi guys, How can i achieve this effect using just a single line of text and css. Right now i am using multiple &lt;h2&gt; tags and a css class to achieve this effect. Is it possible to achieve this only with css or do i have to use Javascript as well?</h2>

The main problem with this according to me is, I cannot make it responsive without decreasing font size, padding, etc which i don’t want.

And even if i make it responsive i cannot add line breaks wherever i want without using other tags or javascript.

How did you guys get around this?

How can i achieve this effect using a single heading/any tag and with css

  • 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-13T12:22:08+00:00Added an answer on June 13, 2026 at 12:22 pm

    one, of the tons of solutions

    <h2 class="heading">
        <span>Hi guys, How can i achieve this effect using just a single</span>
        <span>line of text and css. Right now i am using</span>
        <span>multiple &lt;h2&gt; tags and a css class to achieve this effect.</span>
        <span>Is it possible to achieve this only with css or do i have to use Javascript as well?</span>
        <span class="clear"></span>
    </h2>
    

    with this styles in <head>

    <style type="text/css">
        h2.heading {
            background:#0f0;
            padding:2px;
            float:left;
        }
    
        h2.heading span {
            clear:left;
            display:block;
            float:left;
            background:#fff;
            padding:1px;
            margin:1px;
        }
    
        h2.heading .clear {
            clear:left;
            margin:0px;
            padding:0px;
            float:none;
        }
    </style>
    

    EDIT: second variant

    <style type="text/css">
        h2.heading {
            background:#0f0;
            padding:2px;
            display:inline-block;
            font-size:20px;
        }
    
        h2.heading span {
            background:#fff;
            padding:1px;
            margin:1px;
            line-height:30px;
        }
    </style>
    

    with this markup

    <div style="width:300px;">
        <h2 class="heading">
            <span>Hi guys, How can i achieve this effect using just a single line of text and css. Right now i am using multiple &lt;h2&gt; tags and a css class to achieve this effect. Is it possible to achieve this only with css or do i have to use Javascript as well?</span>
        </h2>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I currently using transactional replication with updatable subscription. Is there any ways
Right now I'm using Trac with multiple projects and have customized the project-listing template
I'm using perlbrew right now to manage multiple versions of perl, but perlbrew is
I have a bunch of code I am using in multiple projects. Right now,
Right now im using a function in my sprite class called SetTextureColour: public void
Right now I am using this to export a repeater (with multiple nested repeaters)
I'm developing my firs app for android right now, I am using multiple tables
We are using a Java EE application and we are right now using Informix
Right now I am using sqlite within a ios application, and I want to
Right now I am using a custom list view and I am inflating an

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.