Jerry D
Jerry D

Reputation: 391

How can I include space between sentences in my <marquee>?

I’m using a <marquee> tag on top of my site’s homepage and want to include some small headlines. My problem is I can’t make space between the headlines, they come out too close together.

I’ve already tried including a big space like this:

<marquee>Headline1 Headline2</marquee>

And I’ve tried including a line break like this:

<marquee>Headline1 Headline2 </marquee>

So I am expecting to have a big space between the two headlines, but those two attempts have resulted in only one space between them.

Upvotes: 2

Views: 4869

Answers (2)

JonoJames
JonoJames

Reputation: 1223

Ok I tried the accepted answer above using the CSS flex but had no luck It still ignored the space on google chrome .

I got the space between the elements using a margin-right CSS attribute in the span tag..

        <marquee style="background-color: #222031; ">
           <span style="color:#70db70;margin-right:200px"> BTC :  44.50 USDT </span>
           <span style="color:#f3865c;margin-right:200px"> ETH :  12.40 USD </span>
        </marquee>

Upvotes: 1

Henfs
Henfs

Reputation: 5411

I know you didn't use tags inside, but a better practice would be to enclose each of those headlines into tags, like span, div or p. Like this:

<marquee>
    <span>Headline1</span>
    <span>Headline2</span>
</marquee>

Then, you could set the CSS using flexbox to create the space between them, like this:

marquee {
    display: flex;
    justify-content: space-between;
}

Hope it helps.

Detail: Marquee feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

Upvotes: 3

Related Questions