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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:21:02+00:00 2026-06-15T10:21:02+00:00

I have following HTML for a heading. The .left and .right are empty spans.

  • 0

I have following HTML for a heading. The .left and .right are empty spans. I have specific width for the .left and but the .text width is not always same. I want to set the background for the .left (fixed width) and the .right. The .right should get all the remaining space in the parent element (h1). How that can be done?

<h1>
    <span class="left"></span>
    <span class="text">Text</span>
    <span class="right"></span>
</h1>

I’m trying following CSS which does not work:

.left{
    background: yellow;
    width: 30px;
    height: 20px;
    display: inline-block;
}

.right{
    display: inline-block;
    background: blue;   
}

Here’s the JSFiddle link:
http://jsfiddle.net/jMR8u/

Here’s what I’m trying to get:enter image description here

The idea is to set a background image in h1 except the .text span and the problem is that I can not set the background for the .text, otherwise it would be easier.

  • 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-15T10:21:02+00:00Added an answer on June 15, 2026 at 10:21 am

    if i interpret your image correct .. this is the answer http://jsfiddle.net/jMR8u/4/

    h1{
        border: 1px solid red;
        position: relative; 
    }
    
    .left{
        background: yellow;
        width: 30px;
        height: 20px;
        display: inline-block;
    }
    
    .right{
        display: inline-block;
        background: blue;
        position: absolute; 
        z-index: 99;
        height: 20px;
        width: 100%;
    }
    ​.text {
        height: 20px;
        width: 150px;
        display: inline-block;
        position: relative;
        z-index; 101;
    }​
    

    ok, then use layers .. with z-index and positioning

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following HTML: <div class=olympics style=display: block; position: absolute; left: 250px; top: px;>
I have the following html table <table id={64ED3A94-5833-4CC7-869F-CCE583B498BE} class=ms-listviewtable width=100% cellspacing=0 cellpadding=1 border=0 xmlns:o=urn:schemas-microsoft-com:office:office
I have the following html page: <body> <div class=hide1 style=width:1000px; height:1000px;> <table width=100% border=0
I have the following HTML: <div id=modal ><div class=modal-window> <ul class=action-tabs right> <li><a href=#
I have the following html: <div class=container> <img src=.../> <p>Heading</p> </div> I want this
I have the following html syntax <ul> <li class=heading>link</li> <li>link</li> <li>link</li> <li>link</li> <li>link</li> <li
I have the following html: <div id='social'> <img src=twitter.png alt=Twitter/> </div> <h1>Heading</h1> I would
I have the following HTML below but what I was wanting to know is
I have the following code inside mytemplate/html/com_content/featured/default.php <?php if (!empty($this->lead_items)) : ?> <div class=<?php
I have the following code that generates the desired HTML. But it prints it

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.