Jump to content

Text within code blocks appearing off-centred in published website compared to the editor

Recommended Posts

I've been working on a website for a little while now and decided to publish with password to see what it would look like for the end user (compared to the editor).

To my surprise, a code block that is alligned with a text block (in terms of the block arrangement in the editor) are perfectly alligned and the animations run smoothly. However, in the client version, the code block seems to have shifted downwards horizontally a fair bit.

Attached is the image I see from the editor.

The actual website can be accessed here:

https://daisy-pineapple-39th.squarespace.com/

Password: cheese

The code used for the animation is as follows:

HTML:

<body>
  <div class="card">
    <h1>
      <!-- Scroller Start -->
      
      <div class="scroller">
        <span>
          tutor<br/>
          life-saver<br/>
          mentor
        </span>
      </div>
      
      <!-- Scroller End -->
    </h1>
  </div>
</body>

CSS:

* {
  box-sizing: border-box;
}
h1 {
  font-weight: light;
}
a {
  text-decoration: none;
  background: linear-gradient(135deg, rgba(43,171,217,1) 0%, rgba(0,130,200,1) 100%);
  -webkit-background-clip: text;
  color: transparent;
}
html, body {
  background: linear-gradient(135deg, rgba(43,171,217,1) 0%, rgba(0,130,200,1) 100%);
  font-family: "Montserrat", Arial;
}
.note {
  font-size: 0.8em;
  color: #3232DA;
  position: relative;
  margin-top: 4em;
  }

/* Scroller styling */
.scroller {
  height: 1.2em;
  line-height: 1.2em;
  position: relative;
  overflow: hidden;
  width: 10em;
}
.scroller > span {
  position: absolute;
  top: 0;
  animation: slide 4s infinite;
  font-weight: bold;
  color: #3232da;
  
}
@keyframes slide {
  0% {
    top: 0;
  }
  33% {
    top: -1.2em;
  }
  66% {
    top: -2.4em;
  }
}

Any help would be greatly appreciated!

forumhelp.png

Link to comment
  • Replies 1
  • Views 315
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.