Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 01:41

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Text-align doesn't completely center

Discussion on Text-align doesn't completely center within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1
 
Summerly's Avatar
 
elite*gold: 1290
Join Date: Jun 2010
Posts: 107
Received Thanks: 58
Text-align doesn't completely center

Hi guys,

Looking for a little help here. I don't have any knowledge of coding or whatsoever but managed a little here and there by just trying. I'm stuck on something that really bothers me:

Text-align: center does kinda center my text but I would like to move it slightly to the left so the text matches with the avatar. I have no idea how to do this.

Example of what bothers me:


Example of what I want:


Code:
Code:
.userLevelContainer {
	position: relative;
	background: $userlevelColor_001;
	box-sizing: content-box;
	display: flex;
	flex-direction: row;
	flex-wrap: nowrap;
	justify-content: flex-start;
	height: $userLevelBarHeight;
	width: 110%;
	text-align: center;
	border-radius: $userLevelBorderRadius;
	padding: 3px;
	
	.badgeOnline {
		position: absolute;
		left: -1px;
		bottom: -1px;
		color: transparent;
		padding: 0;
		background-color: #27ae60;
		border: 1px solid rgba(255, 255, 255, 1);
		border-radius: 50%;
		content: "";
		height: 13px;
		width: 13px;
	}
	
	.userAvatar {
		.userAvatarImage {
			border-radius: $userLevelBorderRadius;
			height: $userLevelBarHeight !important;
			width: $userLevelBarHeight !important;
		}
	}
	
	.userLevel, .username {
		line-height: $userLevelBarHeight;
		font-weight: bold;
	}
	
	.userLevel {
		color: #fff;
		padding: 0 10px 0 5px;
		font-size: 18px;
	}
	
	.username {
		background-color: $wcfSidebarBackground;
		flex: 1;
		border-radius: $userLevelBorderRadius;
		padding-left: 10px;
		font-size: 16px;
		color: $wcfSidebarText;
		top: 0px;
		white-space: nowrap;
		overflow: visible;
		text-overflow: ellipsis;
		
		
		&:hover {
			color: $wcfSidebarLinkActive;
		}
		
		&.longUsername {
			font-size: 16px;
		}
	}


Thanks in advance.
Summerly is offline  
Old 06/28/2019, 22:40   #2
 
elite*gold: 100
Join Date: Apr 2008
Posts: 860
Received Thanks: 1,487
It's kinda hard to work with this. Can you put the CSS code as text so we can test without having to copy the CSS from the image? Having the corresponding HTML would also be nice.

Best would be to create a simple example in a fiddle:
florian0 is offline  
Thanks
1 User
Old 06/29/2019, 05:48   #3


 
iMostLiked's Avatar
 
elite*gold: 1337
Join Date: Apr 2013
Posts: 6,485
Received Thanks: 3,190
Well, that probably is because of setting the width to 110%, which causes the container to move slightly to the right. Have you tried setting the width to 100%?

But yeah, just create a fiddle as @florian0 already suggested and please include your html code as well as css code. We can't really help you with that.

Also, why are you centering the text with text-center if you're already using flexbox?
iMostLiked is offline  
Thanks
1 User
Old 06/30/2019, 19:53   #4
 
elite*gold: 0
Join Date: May 2014
Posts: 4,408
Received Thanks: 934
Try
HTML Code:
width: auto; or width: 100%;
and also try
HTML Code:
margin: 0 auto;
Michi is offline  
Thanks
1 User
Old 07/01/2019, 14:23   #5
 
elite*gold: 0
Join Date: Jul 2019
Posts: 3
Received Thanks: 1
try to remove Padding and others of the Container and the only leftbehind is text-aling:center ;

if you want to debug it goto moz/chrome right click Inspect->bottom left style and find the Container and childs to edit it ...
TanGzkie is offline  
Thanks
1 User
Old 07/02/2019, 00:22   #6
 
Summerly's Avatar
 
elite*gold: 1290
Join Date: Jun 2010
Posts: 107
Received Thanks: 58
Thank you for your replies.

Florian0 : I edited my post with an editable code, sorry for that.

iMostLiked : I tried changing it to 100% but that reduces the width of the complete box, keeping the text at the same spot.

Michi : Your ideas unfortunately didn't work, thank you though.

TanGzkie : I can't delete parts of the code since this code is overlapping the base-code which pretty much uses the same commands. I would have to unwrap the package of the plugin to change the original code & I am pretty afraid of ******** up.

Greets Summerly
Summerly is offline  
Old 07/02/2019, 03:20   #7
 
elite*gold: 0
Join Date: Jul 2019
Posts: 3
Received Thanks: 1
I attach some picture so that you can analyze it
i can edit it using Inspect of browser... but if i hit f5 = refresh page..
it will be gone.. my intension is to know what is the exact design i want

you will notice to the bottom right it has an " td.alt{} "

TanGzkie is offline  
Old 07/02/2019, 06:05   #8


 
iMostLiked's Avatar
 
elite*gold: 1337
Join Date: Apr 2013
Posts: 6,485
Received Thanks: 3,190
Quote:
Originally Posted by Summerly View Post
Thank you for your replies.

Florian0 : I edited my post with an editable code, sorry for that.

iMostLiked : I tried changing it to 100% but that reduces the width of the complete box, keeping the text at the same spot.

Michi : Your ideas unfortunately didn't work, thank you though.

TanGzkie : I can't delete parts of the code since this code is overlapping the base-code which pretty much uses the same commands. I would have to unwrap the package of the plugin to change the original code & I am pretty afraid of ******** up.

Greets Summerly
I still see no jsfiddle or html/css code in your startpost.
Please create a and share it with us.
iMostLiked is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
GFX Design - Align [XGPatrick]
01/21/2015 - Artist Trading - 5 Replies
http://i.epvpimg.com/06aef.png
Align change color near the name
11/15/2013 - Metin2 Private Server - 0 Replies
Hey elitepvpers, Someone know how to change that colour ? http://i.epvpimg.com/kukof.jpg I Pay for the work. Send me a PM Regards. #EDIT
[Dif]Changing showing from Lv99Align Nick to Poziom 99 Align Nick
01/03/2013 - Metin2 PServer Guides & Strategies - 16 Replies
Hello. This diff will change the way of showing level and alignment from Lv99Good Nick to Poziom 99 Good Nick. "Poziom" is in polish language, but if you know how use ASCII you can change it to e.g. Level. Before use dif: http://screenshu.com/static/uploads/temporary/jq/ kn/26/g1ktms.jpg After use dif: http://screenshu.com/static/uploads/temporary/gx/ ym/3y/tjwjew.jpg



All times are GMT +1. The time now is 01:42.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.