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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:57:34+00:00 2026-06-06T16:57:34+00:00

I have the following div <body> <span style=border:1px solid red; display:inline-block> Some text<br />

  • 0

I have the following div

<body>
<span style="border:1px solid red; display:inline-block">
    Some text<br />
    <hr />
    some more text
</span>
</body>

In “normal” web browsers, the width of the div is calculated to fit the text. And the hr is 100% of the div.
enter image description here

But in IE7 the hr causes the div to expand to 100% of the body.
enter image description here

Is there any clever css I need to add somewhere so it behaves correctly in IE7?

Please note, I can’t set any fixed width.

  • 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-06T16:57:35+00:00Added an answer on June 6, 2026 at 4:57 pm

    The width property of the <hr> tag has been deprecated, so you’re styling options are limited on the <hr> tag.

    • 15.3 Rules: the HR element
    • Index of Attributes

    A more modern approach is to use the border property of a <div> instead.

    Image rendered by IE 7:

    enter image description here

    Image rendered by Chrome 19:

    enter image description here

    • jsFiddle Demo

    HTML

    <body>
      <div style="border:1px solid red; float:left;">
        <p>
          Some text
        </p>
        <p class="border-top">
          some more text
        </p>
      </div>
    </body>​​​
    

    CSS

    ​.border-top{
      border-top:#000 1px solid;
      padding-top:1em;
    }​
    

    Note: IE 6 & 7 don’t support display:inline-block, so you might need to use float:left instead. The article below compares the use of the aforementioned properties:

    • CSS display: inline-Block: Why It Rocks, And Why It Sucks
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Given the following HTML: <!doctype html> <html> <body> <span style=background-color: blue;> Some text here
i have html code that looks like the following: String html = <html><head><style type=\text/css\></style></head><body><div
Say I have the following HTML: <div> <span>span text</span> div text <span>some more text</span>
I have the following code: <body> <div id=container style=position:absolute; left:0px; top:0px; z-index:1;> <div id=div1
I have the following html divs : ... <body> <div id=barChart_div style=width: 600px; height:
I have the following elements in a HTML page: <body> <div style=height:100%; width:100%> <div
I have the following code: <html> <body> <div style=background-color: lightblue; onClick=alert(myArray[0][1])> this is a
I have the following html code. <html> <body> <div style=max-width:1600px; min-width:900px; > <table> </table>
Lets say i have the following web page: <html> <body> <div class="transform"> <span>1</span> </div>
If I have the following markup <div id=previewNote class=note yellow style=left:25;top:25px;z-index:1;> <div class=body></div> <div

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.