Change an Element's Relative Position!

I am trying to use a CSS offset to move it 15 pixels away from the top of where it sits in the normal flow but i have failed to

<style>

h2:{ position: relative; 
       top: 15px;
}

</style>

<body>

<h1>On Being Well-Positioned</h1>

<h2>Move me!</h2>
<p>I still think the h2 is where it normally sits.</p>

</body>

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums

1 Like

Hey! hi! howdy! hello!

well, in your css style tag you are placing ‘:’ after your h2 tag and that should not be there, remove the ‘:’ and you’re ready to go :slight_smile:

like this:

<style>

h2{ 
  position: relative; 
  top: 25px;
}

</style>