Home Entrance Everyone Wiki Search Login Register

Welcome, Guest. Please login or register. - Thinking of joining the forum??
April 25, 2024 - @716.16 (what is this?)
Forum activity rating: Three Star Posts: 47/1k.beats Unread Topics | Unread Replies | Own Posts | Own Topics | Random Topic | Recent Posts
News: :ozwomp: Reminder: Forum messages stay readable for years! Keep yours high quality! :ozwomp:

+  MelonLand Forum
|-+  World Wild Web
| |-+  ✁ ∙ Web Crafting
| | |-+  ☔︎ ∙ I need Help!
| | | |-+  How to allign


« previous next »
Pages: [1] Print
Author Topic: How to allign  (Read 878 times)
SilkSkull
Hero Member
*****


SpaceHey: Friend Me!
iMood: SilkSkull
Matrix: Chat!

View Profile WWW

First 1000 Members!MARIO64.PNGCool Dude AwardJoined 2022!High Speed Ozwomp!
« on: October 02, 2022 @157.79 »

How do I align my text the the centre of a page? I know that it involves CSS but I can't figure out how to work <stlye> for the life of me, here is my code as of now:

https://ibb.c:ha:7XHkqjf
Logged

She/Her
"Will you stop adding lampposts to my games?"

Guest
Guest
« Reply #1 on: October 02, 2022 @192.25 »

If you just want to centre-align the text itself, add style="text-align: center;" to your HTML element that holds the text (<div>, <p>, etc.)

If you want to centre an element horizontally on the page, like a <div>, you can do so by setting a width that's less than 100% of its parent container and then adding style="margin: 0 auto;".

Those are the two easiest solutions to the most common use cases. There are a lot of different ways to position things on the page, but since you're just starting out you probably don't want to get into flex or grid yet.
Logged
SilkSkull
Hero Member
*****


SpaceHey: Friend Me!
iMood: SilkSkull
Matrix: Chat!

View Profile WWW

First 1000 Members!MARIO64.PNGCool Dude AwardJoined 2022!High Speed Ozwomp!
« Reply #2 on: October 02, 2022 @198.54 »

If you just want to centre-align the text itself, add style="text-align: center;" to your HTML element that holds the text (<div>, <p>, etc.)

If you want to centre an element horizontally on the page, like a <div>, you can do so by setting a width that's less than 100% of its parent container and then adding style="margin: 0 auto;".

Those are the two easiest solutions to the most common use cases. There are a lot of different ways to position things on the page, but since you're just starting out you probably don't want to get into flex or grid yet.

So I followed what you said and it is still sticking to the left side of the page, did I enter the <style> tag wrong?

My New Code:
https://ibb.c:ha:7XHkqjf

Site:
https://ibb.c:ha:vQSp0Fb
Logged

She/Her
"Will you stop adding lampposts to my games?"

Gans
Sr. Member
****


Scrap Vulture


View Profile

First 1000 Members!€100 IRC InvestmentJoined 2022!
« Reply #3 on: October 02, 2022 @292.60 »

There is a <center>...</center> tag.
It's obsolete, but it works.
https://www.w3.org/TR/html401/present/graphics.html#edef-CENTER
Logged
Melooon
Hero Member ⚓︎
*****


So many stars!

SpaceHey: Friend Me!
StatusCafe: melon
iMood: Melonking
Itch.io: My Games

View Profile WWW

First 1000 Members!spring 2023!Squirtle!!!!MIDI WarriorMIDI Warrior1234 Posts!OzspeckCool Dude AwardRising Star of the Web AwardMessage BuddyPocket Icelogist!OG! Joined 2021!The Smallest Ozwomp Known To ManBug!
« Reply #4 on: October 02, 2022 @556.66 »

My New Code:
https://ibb.c:ha:7XHkqjf

I think thats the same code image you posted already :omg:k: (You could also paste the code here in code tags)
Code
like this
Logged


everything lost will be recovered, when you drift into the arms of the undiscovered
SilkSkull
Hero Member
*****


SpaceHey: Friend Me!
iMood: SilkSkull
Matrix: Chat!

View Profile WWW

First 1000 Members!MARIO64.PNGCool Dude AwardJoined 2022!High Speed Ozwomp!
« Reply #5 on: October 02, 2022 @639.75 »

Thank you guys for all the help! Turns out I'm a little dumb lol. Also should it work the same with aligning to the left and right?
Logged

She/Her
"Will you stop adding lampposts to my games?"

Pages: [1] Print 
« previous next »
 

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021, Simple Machines | Terms and Policies Forum Guide | Rules | RSS | WAP2


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