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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:06:41+00:00 2026-06-02T05:06:41+00:00

I have an inline element with a line break in it. It has padding

  • 0

I have an inline element with a line break in it. It has padding on all sides. However, the side padding on where the line break cuts the element is not there.

This is what i mean:

http://jsfiddle.net/4Gs2E/

There should be 20px padding on the right of tag and left of with but there isnt.
The only other way I can see this working is if i create a new element for every line but this content will be dynamically generated and will not be in a fixed width container so i dont see that working out. Is there any other way I can do this in css without any javascript?

I want the final result to look like this :
http://jsfiddle.net/GNsw3/

but without any extra elements

i also need this to work with display inline only as I want the background to wrap around the text as inline block doesnt do this

Is this possible?

edit, altered the examples to make what i want more visible:

current
http://jsfiddle.net/4Gs2E/2/

what i want it to look like
http://jsfiddle.net/GNsw3/1/

  • 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-02T05:06:43+00:00Added an answer on June 2, 2026 at 5:06 am

    In some cases you can use box-shadow for a workaround.

    Move the right and left padding of the element to its parent and add two box-shadows.

    The result: http://jsfiddle.net/FpLCt/1/

    Browser support for box-shadow: http://caniuse.com/css-boxshadow

    Update:

    There is also a new css property for this issue called box-decoration-break. It is currently only supported by opera, but hopefully more browsers will implement this soon.

    Hope this helps

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

Sidebar

Related Questions

I have this line to add a new element in the screen, but the
I have an inline member function defined under class MyClass int MyClass::myInlineFunction(); This function
I have an li styled as follows: li{ display:inline-block; padding:5px; border:1px solid none; }
I am trying to display an html element, but it has to have the
I have a list and each list element is inline. I add border to
I have a messy html that looks like this: <div id=:0.page.0 class=page-element style=width: 1620px;>
Is it possible to know the line-boxes a block element with inline elements inside
I have a <a> element as inline block with a fixed width. I would
I have this fiddle where there is a rollover style applied to a paragraph
By line break I do not mean the <br /> tag. Rather what I

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.