The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Complex (?) div border issue

  • This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #147925

    I want to wrap a border around a div but I want the border top and bottom to just extend say 20% or a set px towards the middle and then stop.

    Is this possible with CSS3 or do I require Java or something to make it happen? My goto solution is to set a bg top and bg bottom with the lines but it’s not very optimal for responsiveness. Or set a bg-color around the title and extend it over the div somehow to hide the lines, but everything feels hacky, would be cool to get it working with CSS.

    And to get the idea:

    Any ideas appreciated!


    Your explanation seems a bit vague to me. Do you really want a thick border or are you wanting a background for some content?

    If the latter, you could either use a second layer of Divs or simply use a CSS gradient with color stops at 20% and 80% like this:


    I think that did the trick wolfcry911, thank you!

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘CSS’ is closed to new topics and replies.