Site logo

Archived topic

Seperation Line for Headline

13 replies · Started by melvin on August 30, 2021

Viewing posts 1–14 of 14

Hi Melvin,

Can you link us to the page where this should be applied? To inspect the page and find the necessary selectors for CSS writeup.

Let us know. :D

Hi Elvin,

Thanks for the quick response, I've attached the page as per requested.

You may have to modify the HTML tag of that headline to add a span tag. You'll have to add additional CSS class "with-sidelines" to it.

Here's an example: https://share.getcloudapp.com/NQuYYvol

And then add this CSS:

.with-sidelines{
    position: relative;
}
.with-sidelines:before {
    content:"";
    width: 100%;
    height: 4px;
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%) translateZ(-5px);
    background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(9,9,121,1) 50%, rgba(255,255,255,0) 100%);
    z-index: 0;
}

.with-sidelines span {
    position: relative;
    z-index: 10;
    background-color: white;
    padding: 0 20px;
}

Change the background color and height to your preference.

Perfect!

Thanks Elvin, appreciate your kind support!

TQ

In case you need it:

You can generate CSS for the gradient colors from this site - https://cssgradient.io/

No problem. glad to be of any help. :D

Noted with thanks. I appreciate the additional gradient color info.

Stay safe!

No problem. :D

For the spacing,

You have this CSS:

.with-sidelines span {
    position: relative;
    z-index: 10;
    background-color: white;
    padding: 0 20px;
}

The space is coming from the padding value.

Change the padding from padding: 0 20px; to padding: 0 0 0 20px;

The padding value is for top, right, bottom and left. I've basically removed the padding on the right. You can adjust the 2nd 0 to adjust the right padding.

As for the mobile separation.

You can try adding this CSS so they stack together when the mobile viewport is too small to fit "Brands we carry" in 1 line.

.with-sidelines > span {
    display: flex;
    flex-direction: column;
}

Hi Elvin,

Thanks for your quick response.

I've done inserting the code you provided above, however the layout is kind of weird (refer to layout 3)
https://imgur.com/a/7Hpkrgh

What I would want to achieve is simply changing the word "Brands" to red color in Layout 1, the rest of the layout 1 remain unchange. Can you guide me how to achieve that?

TQ

Ah right.

I think we need to change the selectors you're using. We may have to be more specific.

Can you remove this CSS?

.with-sidelines span {
    position: relative;
    z-index: 10;
    background-color: white;
    padding: 0 0 0 20px;
    display: flex;
    flex-direction: column;
}

And try this:

@media (max-width:600px){
    .with-sidelines > span {
        display: flex;
        flex-direction: column;
    }
}

.with-sidelines > span {
    position: relative;
    z-index: 10;
    background-color: white;
    padding: 0 20px 0 20px;
}

Also, can you wrap the text " we carry" on a span tag as well?

Let us know.

Hi Elvin,

I've resolved the issue.

Basically I just add a class to wrap the headline title, then everything is solved.

I appreciate your support.

TQ

Melvin

Nice one. Glad you got it sorted. :)

This archived topic is closed to new replies.