This zone is sleeping right now! ZzzZZzzz

Better not disturb it! ~You go to the petrol station and buy a slushy instead, everything is cool!~

This area will open again in 000.beats!

(Learn about Swatch Time)

Some other zones are awake :^]


Artifacts Gallery Guilds Search Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining?
Autumn, 19 Oct 2026 - @462.30
Forum Activity: Three Stars Random | Recent Posts | Guild Recents
News: :defrag: Lo and Behold :defrag: Guild Events: TIME FOR HALLOWEEN CRAFTS!
Super News: ~~MelonLand's Halloween Profile Design Contest 2026~~
+  MelonLand Forum
|-+  Da Web Revival
| |-+  ✁ ∙ Web Crafting
| | |-+  ☔︎ ∙ I need Help!
| | | |-+  HELP: Text does not want to be centered properly


« previous next »
Pages: [1] Print Embed
Author Topic: HELP: Text does not want to be centered properly  (Read 1457 times)
BlazingCobaltX
Hero Member ⚓︎
*****
View Profile WWW


⛺︎ My Room
StatusCafe: blazingcobaltx
RSS: RSS

Guild Memberships:
Artifacts:
First 1000 Members!Joined 2023!
« on: Autumn, 03 Oct 2023 @421 » Embed

For my site I am using a premade template that has some odd quirks. One in particular is that, when using <center>, text doesn't fully center according to the box but according to the span of the text. Example page here.

Relevant (I think) CSS:
Code
.container{
display: flex;
flex-direction: column;
margin-left: 200px;
}
 
.boxgap{
display: flex;
flex-direction: column;
gap: 1rem;
}
 
.box{
display: flex;
flex-direction: row;
background-color: #fffefc;
border: 3px solid #967e68;
}

.left{
border-right: 3px solid #967e68;
padding: 0.7rem;
text-align: center;
}

.right{
padding: 1rem;
}

I've tried editing the display from flex to something else but the CSS seems highly unresponsive (same issue with changing font sizes). The only fix I've found is to make an entirely different div. This one somehow allows itself to be centered. What is happening?

Code
.scrollbox{
display: block;
flex-direction: row;
background-color: #fffefc;
border: 3px solid #967e68;
height: 500px;
overflow: auto;
}

Many thanks in advance.

Logged

https://blazingcobaltx.neocities.org/images/arceus.png
TheNothingMonster
Sr. Member ⚓︎
****
View Profile WWW


Hey psst! Wanna see something spooky?
⛺︎ My Room
StatusCafe: thenothingmonster

Artifacts:
Great Posts PacmanFirst 1000 Members!Joined 2023!
« Reply #1 on: Autumn, 03 Oct 2023 @531 » Toggle Font Embed

<center> will act a bit strangely when working with flex properties. It's a kind of tag that is not really needed (nor suggested) when working with certain CSS stylings.

Whenever you want to center a div, I suggest you adding margin-right: auto; & margin-left: auto; to its properties.

Since the content you want to center are inside the ".right" div, you can just add these properties to it. That should do it! :ha:

Code
.right{
  padding: 1rem;
  margin-right: auto;
  margin-left: auto;
}

If something is not working for you, let me know!

Logged

~~~~~~~~~~~~
BlazingCobaltX
Hero Member ⚓︎
*****
View Profile WWW


⛺︎ My Room
StatusCafe: blazingcobaltx
RSS: RSS

Guild Memberships:
Artifacts:
First 1000 Members!Joined 2023!
« Reply #2 on: Autumn, 03 Oct 2023 @555 » Embed

<center> will act a bit strangely when working with flex properties. It's a kind of tag that is not really needed (nor suggested) when working with certain CSS stylings.

Whenever you want to center a div, I suggest you adding margin-right: auto; & margin-left: auto; to its properties.

Since the content you want to center are inside the ".right" div, you can just add these properties to it. That should do it! :ha:

It worked!! Learned something again, thank you very much :4u: 

Logged

https://blazingcobaltx.neocities.org/images/arceus.png
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
@000 Melon
Land
Forum Art Hub Chat Webring Explore Random Recent Tenement Arcade Want to Login or Join ? Web Craft Guide Graphic Catalogue Wiki Help I'm Lost! Link Land Newsletters Image Stream Minecraft: Online
Zap!
Passport Sites tamaNOTchi Asatte Add your site?
Aero Archive Onio Cafe 32 Bit Cafe Status Cafe