-1

I am having trouble figuring out how to nicely center vertically sliding text on my webpage. Here is the example snipet: http://turistickemagnetky.sk/slide/

At the moment the & symbol jumps around to accommodate the sliding text before it. What I would like to achieve is to lock the & symbol d in the middle of the page and the sliding text should flow and expand around it as necessary. I am pretty sure there is just some minor css change, but I cant figure it out so any help will be appreciated.

Atavius
  • 9
  • 3

2 Answers2

1

Use display: flex; Remove margins from .cd-intro and set width: 100% (first, unset the max-width). Once .cd-intro is set to 100% width and flexed, give it a height: 100vh; and align-items: center; justify-content: center;

That actually worked for me. I don't know if that's what you're looking for.

.cd-intro {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
M4FI4S
  • 160
  • 7
0

Add this CSS:

section.cd-intro {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
}

section.cd-intro > :nth-child(1) {
    justify-self: end;
}

section.cd-intro > :nth-child(2) {
    margin: auto .25em;
}

section.cd-intro > :nth-child(3) {
    justify-self: start;
}
yunzen
  • 30,001
  • 10
  • 64
  • 93