I have a design I’m developing from that has some unique borders I’m sure can be accomplished with the usage of ::before/::after pseudos. While I can create slices of the ‘borders’ within the image design, they won’t be very responsive. I’d rather use CSS. Here are screenshot examples of what I’m trying to work with:
Some of the borders are rather unique. For screenshot three, the top border I’m sure could be split in two (one for ::before and one for ::after the first headline text). However, it’s the perpendicular lines that throw me a little bit (I’m sure I’ll have to use ‘calc(x,x)’ and solid transparent borders to produce the lines). The real challenging one I’m seeing is for screenshot one.
I attempted to work with screenshot 3 (a post slider), and the code is below. I had to set up a ::before psuedo to add a title to the slider. So I’m thinking I may have to add a wrapper around the .et_pb_slider in order to add the broken border around the title?
They use a combination of pseudo elements and border image slices with linear gradients.
I’m sure your designs could be accommodated with those techniques. I’ll take a look when I get back later this afternoon. (For your screenshot 1 I would do it differently and use flex for the 2 orders either side of the text to allow different amounts of text rather than rubbing a line out.)
I’d do something like this assuming you can use your own html.
The others could use similar techniques and you could use pseudo elements with linear gradients for the vertical lines to get gaps in the lines as required.
Hey, @PaulOB.
You always seem to pull through with answers and great examples! I will take a look at these and see how I can implement them in my designs.
Hey, @Archibald.
Thank you for taking the time to offer the suggestion!
I never really thought about SVG, which is a great idea. However, as customized as some of the designs I’m encountering with these borders (I didn’t provide all of the designs I have to develop), I’m wondering if using SVG is going to be more work? There’s all kinds of broken border designs, and I’m looking for a solution that will work across the board on all devices with little CSS bloat as possible.
So one caveat I did encounter is the button, as this isn’t outside of the “box” but within the “description” container, which is layered within the slide itself. I would like to detach and append it to another area of the slide container, but I’m always getting hit with a “Uncaught SyntaxError: expected expression, got ‘.’” error.
So the majority of the styling I’ve done is working with the exception of the way the <div class="et_pb_button_wrapper"> is inlaid in the <div class="et_pb_slide_description"> container.
I’ve tried to use jQuery('.post-slider-with-title .et_pb_button_wrapper'>.detach().appendTo('.btn-wrap'); but it keeps posting a Uncaught SyntaxError: expected expression, got '.' error. If I can get that to work, then I’d imagine styling the broken border around the button would be a breeze.
As hinted in my previous post, the challenge when using SVGs in a background is coping with changes of aspect ratio caused by responsive web design.
You can use more than one SVG in a background. Here I demonstrate using six SVGs for the background of an element of percentage width but fixed height:
That works quite well when the width of browser window is changed. If you change the height the SVGs on the left and right side do not change their heights. For fixed height that could be just two SVGs.