Artifacts Gallery Guilds Search Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining?
May 24, 2026 - @955.19 (what is this?)
Activity rating: Four Stars Posts & Arts: 64/1k.beats ~ Boop! The forum will close in 45.beats! Random | Recent Posts | Guild Recents
News: :ha: :pc: Hello Melonland! :pc: :happy: Guild Events: Spring Themed Projects

+  MelonLand Forum
|-+  Life & The Web
| |-+  ✁ ∙ Web Crafting
| | |-+  ☔︎ ∙ I need Help!
| | | |-+  Different elements of page on top of eachother


« previous next »
Pages: [1] Print Embed
Author Topic: Different elements of page on top of eachother  (Read 24 times)
segacds
Newbie
*
View Profile WWWArt


⛺︎ My Room
SpaceHey: Friend Me!

Guild Memberships:
Artifacts:
CDJoined 2026!
« on: Today at @775.37 » Embed

i'm trying to get the elements on this page to stack as they would normally, but it looks like my box is covering some of it up/pushing them to the side and i'm wondering how to get it so they're top-to-bottom the normal way without messing up my box too much.

here is the code for the page--
Code
<!DOCTYPE html>
<html>
<!-- figure out how to put a sidebar in here for tabs maybe-->
<!-- tabs? art blog shrines fun info i want to put trinkets on ittttt i want a neocities pet-->
<!-- make top banner for new changes i made perhaps (div) -->
<style>
.box {
  background-color: black;
  
  flex-wrap: wrap;

width: 200px

border: 2px white;

border-style: solid;

padding: 5px;
padding-top: 5px;

margin-left: 20%;

margin-right: 20%;

overflow: hidden;

position: absolute;
}
.navbar {
  background-color: black;
  display: inline-block;
  width: 100%;
  height: auto;
  border: 2px;
  border-style: transparent;
  position: fixed;
  top: 0;
  text-align: center;
}
<!-- i just might not even use this man -->
.counter {
  display: flex;
  width: auto;
  position: relative;
  bottom: 0;
  display: inline-block;
}
.content-section {
      display: flex; 

width: 70%;
      flex-wrap: wrap; 

      justify-content: center; 
      margin: 0 auto;
    }
    
audio {
  display: block;
  width: 20%;
  position: center;
}
.swatchtime {
  text-size: 50px;
  display: block;
  width: 50%;
  justify-content:center;
  margin: 0 auto;
  position: absolute;
}
</style>


    <link href="stylesheet.css" rel="stylesheet" type="text/css" media="all">
    <link rel="icon" href="swirlspin.gif" type="image/x-icon"/>
 <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>my website</title>
    
  <body>
  <div class="navbar">
      <a href="index.html">home</a> <a href="about.html">about</a> <a href="posts/archive.html">blog</a> <a href="shrinesindex.html">shrines</a href> <a href="http://users.smartgb.com/g/g.php?a=s&i=g19-03093-42">guestbook</a>
</div>
  <br>
     <h1><marquee
     direction="left"
     >
    welcome to my webpage!
    </marquee>
    </h1>
    <div class="content-section">
  <div class="box">
  <center>
 <img src="rainbowdivider.gif" width=100%>
 <audio src="https://files.catbox.moe/of9ed0.mp3" autoplay></audio>
  <h1><i>Mercury's corner of the web</i></h1>
  </center>
  <p>
  <img src="mayura.gif" width=40%
  align="left"
  style="margin:50px">
  </p>
  <p>hello! my name is <font color=#ff3d6e>mercury</font>! this is my corner of the web <sub><font color=#4a4a4a>which i am still building (i have to reteach myself html :( )</font></sub>. it is nice to meet you ^_^</p>
  <p><a href="coolsites.html">cool sites</a></p>
  <center><details>
  <summary>to-do list</summary>
  <ul>
  <li>create template for character pages</li>
  <li>make sitemap + planned pages</li>
  </ul>
  </center></details>
 <center><p>LAST UPDATE: 5/23/26</p></center>
 <center><script type="text/javascript" src="https://counter.websiteout.com/js/2/6/0/0"></script></center>
 </div>
 <br>
 <!-- MelonLand Guild Widget Code for Nature Camp -->
<script src="https://forum.melonland.net/guilds/ring-variables.php?g=7" defer></script>
<script src="https://forum.melonland.net/guilds/ring-widget.js?g=7" defer></script>
<link href="https://everyone.melonland.net/~nature/butterfly-ring.css" rel="stylesheet">
<!-- trans webring -->
 <script src="https://transring.neocities.org/ring.js" data-widget="cloud"></script>
 </div>
 <footer> <div class="swatchtime">
    <span id="swatchClock"></span>
<script defer src="https://melonking.net/scripts/swatchTime.js"></script>
</div>
</footer>
  </body>
</html>
Logged
ヤーナム
Jr. Member
**
View ProfileArt


hanging out on AIM
⛺︎ My Room

Guild Memberships:
Artifacts:
Joined 2023!
« Reply #1 on: Today at @790.10 » Embed

In your CSS you have position: absolute set on .box. If you remove that the elements will flow naturally. Is that what you're looking to do?
Logged
segacds
Newbie
*
View Profile WWWArt


⛺︎ My Room
SpaceHey: Friend Me!

Guild Memberships:
Artifacts:
CDJoined 2026!
« Reply #2 on: Today at @836.48 » Embed

ohh yes that works!! ty so much the positional stuff confuses tf out of me LOL will keep this in mind for later!!
Logged
ヤーナム
Jr. Member
**
View ProfileArt


hanging out on AIM
⛺︎ My Room

Guild Memberships:
Artifacts:
Joined 2023!
« Reply #3 on: Today at @855.72 » Embed

np glad to help :D Yeah positioning can be tricky. The short version is that by default elements will all flow with each other, so if you put divB after divA then divB will appear after divA exactly like you expect (assuming there aren't other things affecting its visual position, like flex or margins or grid etc.)

When you set position: absolute you also usually need to tell it where to go, you're saying "div, i'm telling you ABSOLUTELY where you should be", like this:

Code
<style>
  .child {
    position: absolute;
    border: 3px dashed blue;
    height: 50px;
    width 50px;

    /* this element should be put 100px from the top of its parent and 100px from the left of its parent */
    top: 100px;
    left: 100px;
  }

  .parent {
    position: relative;
    border: 3px dashed green;
    height: 500px;
    width: 500px;
  }
</style>

<div class='parent'>
  <div class='child'>
    woohoo content
  </div>
</div>

Notice how I put it in a parent element with position: relative. If you use absolute positioning without it being a child of a relative positioned element it will look at all of its ancestor elements all of the way up to the root <html> and position based on that. What was going on in your original code was you set it to absolute without giving it a top/right/bottom/left, so it was removing it from the natural flow but not telling it where to go. Along with its margins it was being dropped right in the middle of the page and covering up other elements.
Logged
Pages: [1] Print Embed 
« previous next »
 

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | Send Feedback | Supporters ♥ Forum Guide | Rules | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi
MelonLand @000

Want to Login or Join ?

Minecraft: Online
Join: craft.melonking.net