Home Events! Entrance Everyone Wiki Search Login Register

Welcome, Guest. Please login or register. - Thinking of joining the forum??
November 21, 2024 - @993.11 (what is this?)
Forum activity rating: Three Stars Posts: 29/1k.beats Unread Topics | Unread Replies | My Stuff | Random Topic | Recent Posts    Start New Topic
News: :skull: Websites are like whispers in the night  :skull:

+  MelonLand Forum
|-+  World Wild Web
| |-+  ✁ ∙ Web Crafting
| | |-+  ☔︎ ∙ I need Help!
| | | |-+  HELP: Text does not want to be centered properly


« previous next »
Pages: [1] Print
Author Topic: HELP: Text does not want to be centered properly  (Read 587 times)
BlazingCobaltX
Full Member ⚓︎
***


⛺︎ My Room
StatusCafe: blazingcobaltx

View Profile WWW

Suck At Something September - Did It!First 1000 Members!Joined 2023!
« on: October 03, 2023 @420.83 »

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

TheNothingMonster
Full Member ⚓︎
***


Hey psst! Wanna see something spooky?

⛺︎ My Room
StatusCafe: thenothingmonster

View Profile WWW

First 1000 Members!Joined 2023!
« Reply #1 on: October 03, 2023 @531.08 »

<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
Full Member ⚓︎
***


⛺︎ My Room
StatusCafe: blazingcobaltx

View Profile WWW

Suck At Something September - Did It!First 1000 Members!Joined 2023!
« Reply #2 on: October 03, 2023 @555.17 »

<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

Pages: [1] Print 
« previous next »
 

Vaguely similar topics! (3)

Earthbound Text Generator

Started by ObspogonBoard ♖ ∙ Video Games

Replies: 7
Views: 4799
Last post March 04, 2023 @848.91
by sig
TinyTIM - A cool multiplayer text adventure

Started by MelooonBoard ♖ ∙ Video Games

Replies: 4
Views: 2484
Last post February 22, 2022 @48.80
by demonologi
5 Reasons to use Alt-text and Image Captions (Beyond Accessibility)

Started by MemoryBoard ✁ ∙ Web Crafting

Replies: 6
Views: 1351
Last post August 31, 2022 @977.15
by Memory

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021, Simple Machines | Terms and Policies 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