Misc Others A bit of help with HTML please?

jeffyTheHomebrewer

Neato Burrito!
OP
Member
Joined
Aug 24, 2018
Messages
1,630
Trophies
1
Location
his house!
Website
catboybeebop.neocities.org
XP
3,523
Country
United States
So, I'm porting my old wix site over to neocities, and I'm having some trouble with the logo. Essentially, it's 3 gifs on top of each other; I know, a little stupid, but this is much, much easier than trying to make them into ONE gif for now.
So, I went to stack overflow (here's my thread there about this btw) and didn't really get a good answer to fix this so far.
Sure, it kinda works, but not really.

What I want in the end is for the 3 gifs to be in a div that I can just center with align="center", and just not need to worry about it at all after that.
So, here's the page's code as of writing this post:
HTML:
<title>Work in progress...</title>
<link rel="icon" type="image/x-icon" href="/pages/images/favicons/main.png">
<link rel="stylesheet" type="text/css" href="/style.css">
<!-- CSS and div to make the site logo look the same as the Wix version, modified from https://stackoverflow.com/questions/48474/how-do-i-position-one-image-on-top-of-another-in-html
I might just put this into the main style.css, not sure.-->
<style>
.logo {
  position: relative;
  center: 0
}

.image1 {
  position: absolute;
  center: 0
}

.image2 {
  position: absolute;
  center: 0
}

.image3 {
  position: absolute;
  center: 0
}
</style>

<div class="logo" align="center">
  <img class="image1" src="/pages/images/general/logo/1.gif" />
  <img class="image2" src="/pages/images/general/logo/2.gif" />
  <img class="image3" src="/pages/images/general/logo/3.gif" />
</div>

Now, here's what that results in:
1668051360349.png
It's KINDA centered, but not actually! What the fuck? (and no, using the <center> tag doesn't change anything, it just gives the same result)
I know I'm still new to CSS and generally don't use divs when I make pages, but what the fuck am I doing wrong? It all looks correct, so why doesn't it just be centered?
Oh, and you can click here to see the page update in real time as you guys help me out.
 

shaunj66

GBAtemp Administrator
Administrator
Joined
Oct 24, 2002
Messages
11,971
Trophies
4
Age
39
Location
South England
Website
www.gbatemp.net
XP
25,463
Country
United Kingdom
Get rid of the center property on each CSS declaration. It's not valid.

Remove 'position' from image1 so it gives the parent logo div a calculated height so that any following content added later will be below the logo div.

Add left and right rules to image2 and image3 so the browser knows there to position them then add margin 0 auto (0 margins top and bottom, automatic margins left and right) to centrally position them.

CSS:
.logo {
  position: relative;
}

.image2, .image3 {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0 auto;
}
 

jeffyTheHomebrewer

Neato Burrito!
OP
Member
Joined
Aug 24, 2018
Messages
1,630
Trophies
1
Location
his house!
Website
catboybeebop.neocities.org
XP
3,523
Country
United States
Get rid of the center property on each CSS declaration. It's not valid.

Remove 'position' from image1 so it gives the parent logo div a calculated height so that any following content added later will be below the logo div.

Add left and right rules to image2 and image3 so the browser knows there to position them then add margin 0 auto (0 margins top and bottom, automatic margins left and right) to centrally position them.

CSS:
.logo {
  position: relative;
}

.image2, .image3 {
  position: absolute;
  left: 0;
  right: 0;
  margin: 0 auto;
}
Holy shit, this works pretty much perfectly! (granted changing the align="<value>" still only controls the first image, but whatever, I only ever wanted it centered anyhow)
 

zoyaa10

Member
Newcomer
Joined
Dec 5, 2022
Messages
5
Trophies
0
Age
24
XP
32
Country
India
My suggestion is to use a combination of CSS and HTML to achieve the desired effect. You can use the position property in CSS to place the three images on top of each other and then use the center property to align them. You can also use the div tag to wrap the images and set the align attribute to "center" to center the whole logo. In addition, you can also use media queries to make the logo responsive. This way, the logo can be displayed correctly across different screen sizes.

For example, you can use the following code:

Code:
<style>
.logo {
  position: relative;
  center: 0;
}

.image1 {
  position: absolute;
  center: 0;
}

.image2 {
  position: absolute;
  center: 0;
}

.image3 {
  position: absolute;
  center: 0;
}

@media (max-width: 700px) {
  .logo {
    width: 100%;
  }
}
</style>

<div class="logo" align="center">
  <img class="image1" src
 
  • Like
Reactions: jeffyTheHomebrewer

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BigOnYa @ BigOnYa:
    A friend give me a $35 cigar, and pssf, just as good as a $5 one. But of course gonna have to tell him it was awesome.
  • Psionic Roshambo @ Psionic Roshambo:
    What makes a good Cuban rum soaked cigar is a nice cosmopolitan to go with it.
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Used to do that every time I went to Miami on business
  • Psionic Roshambo @ Psionic Roshambo:
    There was this little bar I would stop in have that combo and watch the beach
    +1
  • BigOnYa @ BigOnYa:
    I've never met a girl named cosmopolitan, but cool. And where do you insert the cigar? Mr clinton
  • Psionic Roshambo @ Psionic Roshambo:
    Slightly more than 35 dollars lol but I was making thousands on a job.
  • Psionic Roshambo @ Psionic Roshambo:
    Cosmopolitan is just vodka and cranberry juice lol
  • Psionic Roshambo @ Psionic Roshambo:
    I'm a martini glass
  • K3Nv2 @ K3Nv2:
    My dental assistant is Cuban I'm gonna have to him for cigars and sandwiches now
    +1
  • BigOnYa @ BigOnYa:
    Yea wish I could get Cubans cheap, they are ridiculous priced up here. But they are hard workers.
  • Psionic Roshambo @ Psionic Roshambo:
    I think I was paying like 75 back in the early 90s
  • Psionic Roshambo @ Psionic Roshambo:
    Rolled on the thighs of virgins if the stories are to be believed
  • K3Nv2 @ K3Nv2:
    I don't think we belive any of your stories
  • Psionic Roshambo @ Psionic Roshambo:
    That's honestly for the best lol
  • BigOnYa @ BigOnYa:
    I'd read his autobiography.
  • K3Nv2 @ K3Nv2:
    "If I may have done it."
  • Psionic Roshambo @ Psionic Roshambo:
    I'm deliberately vague about some of the details sure it's been 30 years but some crimes don't have limitations
  • K3Nv2 @ K3Nv2:
    Psis sex life is Dubai
    FB-IMG-1717887564361.jpg
  • BigOnYa @ BigOnYa:
    Or I picture its like quagmire from family guy, gigity.
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    Back then I was so wasteful with money, didn't bother me to spend 600 bucks in a strip club, some of those private dances though... Lol
  • Psionic Roshambo @ Psionic Roshambo:
    My life back then was a mix of Breaking Bad and John Wick and Dumb and Dumber lol
  • Psionic Roshambo @ Psionic Roshambo:
    The things we do as kids so lucky to be alive lol
  • Sonic Angel Knight @ Sonic Angel Knight:
    Kids put chocolate in their pockets :ninja:
    Sonic Angel Knight @ Sonic Angel Knight: Kids put chocolate in their pockets :ninja: