Entrance Events! Chat Gallery Search Everyone Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining the forum??
February 05, 2025 - @754.32 (what is this?)
Activity rating: Four Stars Posts & Arts: 99/1k.beats Unread Topics | Unread Replies | My Stuff | Random Topic | Recent Posts Start New Topic  Submit Art
News: :eyes: ~ Inconvenience is counterculture ~ :eyes: Super News: E-Zine #3 Accepting Entries!

+  MelonLand Forum
|-+  World Wild Web
| |-+  ✁ ∙ Web Crafting
| | |-+  ☔︎ ∙ I need Help!
| | | |-+  Div alignment


« previous next »
Pages: [1] Print
Author Topic: Div alignment  (Read 235 times)
prismaticpink
Casual Poster ⚓︎
*


⛺︎ My Room
iMood: prismaticpink

View Profile WWW

Joined 2024!
« on: November 26, 2024 @32.91 »

Hi! I don't know if this is the correct title, but I'll try to explain my problem.
This is my website: https://prismatic.pink/
I am using divs as a background to h2 titles.

This is how it looks like on my computer. I want it to look like this on other screens.
Spoiler
[close]

This is how it looks like on my phone (and it looks kinda similar on my iPad and on my husband's computer as well).
Spoiler
[close]

This is my CSS so far:

Code
.widget-title {
	background-image: url('http://prismatic.pink/wp-content/uploads/2024/11/bg-rainbow.gif');
	border-radius: 7px;
	border: 1px solid #736026;
	margin: 1.5em 0em 1.5em 0em;
	height: 1.8em;
	text-align: center;
}

.widget-title h2 {
	color: white;
	text-shadow: 1px 0px #736026, -1px 0px #736026, 0px 1px #736026, 0px -1px #736026;
	margin: -0.5em 0em 0em 0em;
}

I know that using a negative value in "margin" isn't the best idea, but it was totally misplaced without it.
Sorry if it's a stupid question, I'm a beginner  :ok:
Logged

Melooon
Hero Member ⚓︎
*****


So many stars!

⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: melon
iMood: Melonking
Itch.io: My Games
RSS: RSS

View Profile WWWArt

Thanks for being rad!a puppy for your travelsAlways My PalFirst 1000 Members!spring 2023!
« Reply #1 on: November 26, 2024 @65.56 »

Different browsers will have different default margins and padding, so that's prob what your running into; you don't actually need to use a div as a background though, you should just be able to put everything on the h2 and call it a day! That avoids the whole issue  :tongue:

Code
.column-2 h2,
.column-3 h2 {
  color: white;
  text-shadow: 1px 0px #736026, -1px 0px #736026, 0px 1px #736026, 0px -1px #736026;
  background-image: url('/wp-content/uploads/2024/11/bg-rainbow.gif');
  border-radius: 7px;
  border: 1px solid #736026;
  margin: 0.8em 0em;
  height: 1.1em;
  text-align: center;
}

EDIT: Also also, I noticed you changed the universal line-height to 1.5, and everything on the layout is depending on that; that's fine, but I think it might cause you headaches later on - you might wanna rework that and only change line height on specific areas such as p tags or your context boxes ^^
« Last Edit: November 26, 2024 @72.06 by Melooon » Logged


everything lost will be recovered, when you drift into the arms of the undiscovered
Dreamwings
Jr. Member ⚓︎
**


Professional-grade yapper and late to the party

⛺︎ My Room

View Profile WWW

Sealiously Cool User AwardJoined 2024!
« Reply #2 on: November 26, 2024 @69.41 »

I initially thought it was the line header but I think it might be the margin on the h2 element. It's showing for me as well on my laptop on Librewolf so I was able to mess around a bit. The negative margin is what's doing it because when I remove it it goes back to the proper orientation inside the box. I think it's because it's going off the font size in comparison to screen size so if the screen is a completely different size from what you made it on it doesn't like that too much and does that on every other screen.
As for what to do about it, besides setting all the margins to zero which still leads to the font being a little down towards the bottom, I found a solution close to what I think you want. I added to the div...
Code
box-sizing: border-box;
padding-bottom: 2em;
Which still keeps it in the center and based on the font size like you want it to be.
Btw, I LOVE the layout its sooo cute! The rainbow divs are so pretty and they remind me of those rainbow airhead strip things they used to have.
Edit: And someone else seems to have posted a response before me so lol I guess you could use both depending on what implementation you wanna go with.
Logged

<- Feed this guy please, they're so humgry
If I sound angry I'm probably not unless I say so. I'm just really really blunt. :dog:
prismaticpink
Casual Poster ⚓︎
*


⛺︎ My Room
iMood: prismaticpink

View Profile WWW

Joined 2024!
« Reply #3 on: November 26, 2024 @771.69 »

Guys, thank you so much for your help! I tried both Melon's and Dreamwings' suggestions and it works fine on my phone/iPad/husband's pc, but now my laptop looks messed up. lol

Spoiler


[close]

I guess I'll leave it the way it is, it seems to be fine on most screens, so whatever. haha

Quote from: Dreamwings
Btw, I LOVE the layout its sooo cute! The rainbow divs are so pretty and they remind me of those rainbow airhead strip things they used to have.

Thank you so much!! I drew them myself and I wanted them to look "candy-like". I'm glad I was successful hehe

EDIT:

Quote from: Melooon
EDIT: Also also, I noticed you changed the universal line-height to 1.5, and everything on the layout is depending on that; that's fine, but I think it might cause you headaches later on - you might wanna rework that and only change line height on specific areas such as p tags or your context boxes ^^

That's it!!! I removed it and now it's fixed. Thank you so much  :transport:
« Last Edit: November 27, 2024 @938.66 by prismaticpink » Logged

Pages: [1] Print 
« previous next »
 

Vaguely similar topics! (1)

HELP: Text-alignments

Started by dotmidiBoard ☔︎ ∙ I need Help!

Replies: 2
Views: 726
Last post February 28, 2023 @103.22
by dotmidi

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | ~ Send Feedback ~ 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