I’m trying to make an Ebay template. But I have spent 2 whole days (literally) to make everything to stay INSIDE the "frame" div.
But when I resize the page or someone checks it on the phone, all the junk like images and shapes (border items) are all over the place on the white page outside the maroon frame.
I just want everything to be cemented down onto that one div as if it is a canvas and not move nor resize when I resize the browser.
P.S. The cig will not puff due to it being blocked by something. I’m pretty new to this so I’m clueless.
IMPORTANT*: This website does not display my code properly for some reason. Please copy and paste both html and css sections into https://htmledit.squarefree.com/ to view and see what I see. This site’s html viewer is too goofy.
.Frame {
background-color: black;
border: solid 20px maroon;
width: 100%;
max-width: 900px;
margin: 0 auto;
}
.header {
border: solid 1px red;
color: Red;
background-color: ;
height: 60px;
width: 899;
font-size: 35px;
display: flex;
justify-content: center;
align-items: center;
font-family: cursive;
}
.cigbutt {
border: solid 3px white;
width: 40px;
height: 40px;
border-radius: 100px;
margin-left: 510px;
margin-top: -30px;
background-color: 7B2424;
transition: 2.5s;
}
.cigbutt:hover {
background-color: BF3D12;
}
.cigbutt:active {
background-color: EE4007;
}
.moretext {
color: white;
text-align: right;
margin-left: 450px;
margin-top: -90px;
width: 160px;
}
.text {
color: white;
width: 400px;
}
.img1 {
margin-top: -50px;
margin-left: 640px;
width: 250px;
height: 400px;
}
<div class = Frame>
<div class = Header>
Hot Girls And Cigarette Butts
</div>
<br> <br>
<div class = text>
I do not know what to put down so here as an example so here is a hot girl and an interactive circle that looks and acts like a cigarette butt. Please notice how the frame moves but everything else just magically hovers.
</div>
<div class = cigbutt>
</div>
<div class = moretext>
hover over circle to light long press circle to puff
</div>
<img class = img1 src = "https://optimize.webmavens.in/?key=1949128684&url=https://prodimages.everythingneon.com/giant/n105-1565-pole-dance-girls-1-neon-sign.jpg"></img>
<div style = "margin-top: 100px;"></div>
<br>
</div>
2
Answers
If you actually just want to lock down and manually align everything you can begin by setting the frame to be a positioned element (anything but static) and position its children absolutely, adjusting their left, right, top, or bottom attributes as you see fit. https://developer.mozilla.org/en-US/docs/Web/CSS/position
The Primary Mistakes:
class=Frame
but it should beclass="Frame"
;
at the end of each line.#
The main reason
px
for positioning and stylings. Thus it does not scale well, use dynamic units (e.g.em, %
etc) for these.cigbutt
animation was not working due to using margins like that.Fixed code