Jump to content

Adding static element to a page

Recommended Posts

  • Replies 3
  • Views 1.4k
  • Created
  • Last Reply

Top Posters In This Topic

What you want is a fixed element, not a static one. It is done by using position:fixed attribute. Here is an example:

<div id="element">

</div>


<style>
#element {
height:100px;
width:100px;
background:red;
position:fixed;
}
</style>

Try pasting the above code in a code block and the element will be fixed at the top-left corner even when you scroll. You can use top, left, right, and bottom properties to fix the permanent position of the element.

 

Link to comment
  • 1 year later...

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.