Center Logo on Small View

Open to all! Ask other shopowners for help.
Post Reply
User avatar
tessthepup
Certified Developer
Posts: 382
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Center Logo on Small View

Post by tessthepup »

Hi Guys,

I am looking for a bit of inspiration on how to center the store logo on a small screen (testing on a Samsung Galaxy S10+ and chrome browser)

I have the following setup

1. Store logo content module width set to 8
2. Search box content module width set to 4
3. Message module content width set to 12 but set to only be visible on small screen.

I have tried d-flex justify-content-center but nothing changes :roll:

Any ideas would be appreciated.
You do not have the required permissions to view the files attached to this post.


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
Kofod95
Senior Contributor
Posts: 748
Joined: Sat Feb 06, 2021 7:38 pm
Phoenix Version: 1.0.8.20
Has thanked: 99 times
Been thanked: 179 times

Re: Center Logo on Small View

Post by Kofod95 »

Not sure and unable to test right now, so a blind chickens' guess:
text-center or mx-md-auto ?

//Daniel
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Tanya
Member
Posts: 19
Joined: Tue Mar 09, 2021 3:16 pm
Phoenix Version:
Has thanked: 9 times

Re: Center Logo on Small View

Post by Tanya »

I am not sure whether it is correct or not.

I use "text-align:center". It works for me.
You do not have the required permissions to view the files attached to this post.
User avatar
tessthepup
Certified Developer
Posts: 382
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Center Logo on Small View

Post by tessthepup »

Kofod95 wrote: Sat Feb 05, 2022 3:30 pm Not sure and unable to test right now, so a blind chickens' guess:
text-center or mx-md-auto ?

//Daniel
Thanks for the reply Daniel but unfortunately neither worked
User avatar
tessthepup
Certified Developer
Posts: 382
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Center Logo on Small View

Post by tessthepup »

ok I am stumped :?

I have tried every bootstrap centering code I could find but cannot get the logo to center on mobile view

Code: Select all

<div class="col-sm-<?= (int)MODULE_CONTENT_HEADER_LOGO_CONTENT_WIDTH ?> cm-header-logo mb-4 align-self-center">
  <a href="<?= $GLOBALS['Linker']->build('index.php') ?>"><?= new Image('images/' . STORE_LOGO, [], htmlspecialchars(STORE_NAME)) ?></a>
</div>
User avatar
tessthepup
Certified Developer
Posts: 382
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Center Logo on Small View

Post by tessthepup »

Tanya wrote: Sat Feb 05, 2022 3:37 pm I am not sure whether it is correct or not.

I use "text-align:center". It works for me.
oops did not see this reply but going to try it anyway, thanks
User avatar
tessthepup
Certified Developer
Posts: 382
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Center Logo on Small View

Post by tessthepup »

tessthepup wrote: Sun Feb 06, 2022 10:39 am
Tanya wrote: Sat Feb 05, 2022 3:37 pm I am not sure whether it is correct or not.

I use "text-align:center". It works for me.
oops did not see this reply but going to try it anyway, thanks
Unfortunately it did not work theway I need it to.

I want the logo on full screen size to the left of the header and centered on mobile view
ecartz
Core Team
Posts: 3084
Joined: Tue Nov 05, 2019 6:02 pm
Phoenix Version:
Has thanked: 4 times
Been thanked: 208 times

Re: Center Logo on Small View

Post by ecartz »

See https://stackoverflow.com/a/50745227/6660678

The "text-center text-md-left" on the container is the thing that would make it text-align: center on small screens and left on medium screens. You might also find that you want text-sm-left, text-lg-left, or even text-xl-left instead.
User avatar
tessthepup
Certified Developer
Posts: 382
Joined: Mon Mar 01, 2021 5:55 pm
Phoenix Version:
Has thanked: 47 times
Been thanked: 62 times

Re: Center Logo on Small View

Post by tessthepup »

ecartz wrote: Sun Feb 06, 2022 11:22 am See https://stackoverflow.com/a/50745227/6660678

The "text-center text-md-left" on the container is the thing that would make it text-align: center on small screens and left on medium screens. You might also find that you want text-sm-left, text-lg-left, or even text-xl-left instead.
No matter what I try the logo just will not center on small devices

I have another header module which I created that displays a message in the header under the logo but only on small view and this centers perfectly.

Code: Select all

<div class="col-sm-<?php echo $content_width; ?> header_message text-center text-md-center cm-header-message pt-2 d-block d-sm-none">
  <?php echo HEADER_MESSAGE_TEXT; ?>
</div>
MyGamesShop
Contributor
Posts: 131
Joined: Wed Mar 10, 2021 3:02 am
Phoenix Version: v1.1.0.6
Has thanked: 8 times
Been thanked: 5 times

Re: Center Logo on Small View

Post by MyGamesShop »

Have you tried changing in Product Listing 'Products Per Row' settings to see if this is affecting what you're expecting?


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply