W3 Schools CSS - Card wont center

Questions and tutorials related to Cascading Style Sheets *all versions*

Moderators: gesf, Michalio

Post Reply
User avatar
NorseMan
php-forum Fan User
php-forum Fan User
Posts: 68
Joined: Mon Jul 04, 2022 5:25 pm
Location: Near Oslo (Norway)

I have tried different things to center the card below. But it doesn't. What am I doing wrong?
The other styles are working, but it won't center, no matter what. Maybe there is a simple solution for this, but as said, it doesn't work. I have tried inline CSS too. Is it a simple solution for this?

<div class=" w3-card w3-center w3-padding w3-twothird w3-round">
________________
Leon (Norway)
________________

-------
(some of)My configuration is:
Laragon full 5.0 web server with PHP and MySQL installation
(Apache 2.4.47 / PHP 7.4.19 / MySQL 5.7.33)
-------
My toolbox and workbench:
Navicat for MySQL 16.0.13
FileZilla 3.57.1
Among others
-------
Development toolbox:
Adobe DreamWeaver 21.2
Adobe Photoshop 23.1.0
Adobe Illustrator 26.0.2
Adobe InDesign 17.0.1
Adobe XD
Visual Studio Code 1.63.2 (with some extensions enabled)
User avatar
Michalio
Moderator
Moderator
Posts: 361
Joined: Sun Jul 18, 2021 1:33 pm
Location: Poland

try to use

Code: Select all

margin-left: auto;
margin-right: auto;
Free coding lessons: https://php-forum.com/phpforum/viewtopic.php?t=29852
User avatar
NorseMan
php-forum Fan User
php-forum Fan User
Posts: 68
Joined: Mon Jul 04, 2022 5:25 pm
Location: Near Oslo (Norway)

So, Michalio, you mean I should use a inline CSS class in between the w3 Schools CSS?
________________
Leon (Norway)
________________

-------
(some of)My configuration is:
Laragon full 5.0 web server with PHP and MySQL installation
(Apache 2.4.47 / PHP 7.4.19 / MySQL 5.7.33)
-------
My toolbox and workbench:
Navicat for MySQL 16.0.13
FileZilla 3.57.1
Among others
-------
Development toolbox:
Adobe DreamWeaver 21.2
Adobe Photoshop 23.1.0
Adobe Illustrator 26.0.2
Adobe InDesign 17.0.1
Adobe XD
Visual Studio Code 1.63.2 (with some extensions enabled)
User avatar
Michalio
Moderator
Moderator
Posts: 361
Joined: Sun Jul 18, 2021 1:33 pm
Location: Poland

Inline styles are not the best way, so you can create a new class for that. Any css framework isn't perfect so custom css classes are allways needed
Free coding lessons: https://php-forum.com/phpforum/viewtopic.php?t=29852
User avatar
NorseMan
php-forum Fan User
php-forum Fan User
Posts: 68
Joined: Mon Jul 04, 2022 5:25 pm
Location: Near Oslo (Norway)

I've worked a lot with w3school's css framework so I know it well, but I'm still not very experienced with it. So things like that you mention are not so unknown, but I need to hear it to get a reminder since I am not so experienced that everything comes automatically. So thanks for mentioning it 😊👍

I have tried different css frameworks, but it is w3schools css that I think is the easiest to learn and is the most/best developed so far.
________________
Leon (Norway)
________________

-------
(some of)My configuration is:
Laragon full 5.0 web server with PHP and MySQL installation
(Apache 2.4.47 / PHP 7.4.19 / MySQL 5.7.33)
-------
My toolbox and workbench:
Navicat for MySQL 16.0.13
FileZilla 3.57.1
Among others
-------
Development toolbox:
Adobe DreamWeaver 21.2
Adobe Photoshop 23.1.0
Adobe Illustrator 26.0.2
Adobe InDesign 17.0.1
Adobe XD
Visual Studio Code 1.63.2 (with some extensions enabled)
User avatar
Michalio
Moderator
Moderator
Posts: 361
Joined: Sun Jul 18, 2021 1:33 pm
Location: Poland

you can also check the bootstrap (it's very popular) or bulma. I worked with bootstrap many times in projects that I developed so if you will work on any project that was created by someone else then you will need to learn it. I found the bulma css framework when I tried to find good alternative
Free coding lessons: https://php-forum.com/phpforum/viewtopic.php?t=29852
User avatar
NorseMan
php-forum Fan User
php-forum Fan User
Posts: 68
Joined: Mon Jul 04, 2022 5:25 pm
Location: Near Oslo (Norway)

I will check them out, but i think i will stay where i am (or with what i got).
I have tried bootstrap before, but there is a reason i was choosing the w3schools css.
The two other ones i can give a try (at least look at it), but i think i will stay where i am, with the w3schools css framework.
________________
Leon (Norway)
________________

-------
(some of)My configuration is:
Laragon full 5.0 web server with PHP and MySQL installation
(Apache 2.4.47 / PHP 7.4.19 / MySQL 5.7.33)
-------
My toolbox and workbench:
Navicat for MySQL 16.0.13
FileZilla 3.57.1
Among others
-------
Development toolbox:
Adobe DreamWeaver 21.2
Adobe Photoshop 23.1.0
Adobe Illustrator 26.0.2
Adobe InDesign 17.0.1
Adobe XD
Visual Studio Code 1.63.2 (with some extensions enabled)
User avatar
NorseMan
php-forum Fan User
php-forum Fan User
Posts: 68
Joined: Mon Jul 04, 2022 5:25 pm
Location: Near Oslo (Norway)

I will check them out, but i think i will stay where i am (or with what i got).
I have tried bootstrap before, but there is a reason i was choosing the w3schools css.
The two other ones i can give a try (at least look at it), but i think i will stay where i am, with the w3schools css framework.
________________
Leon (Norway)
________________

-------
(some of)My configuration is:
Laragon full 5.0 web server with PHP and MySQL installation
(Apache 2.4.47 / PHP 7.4.19 / MySQL 5.7.33)
-------
My toolbox and workbench:
Navicat for MySQL 16.0.13
FileZilla 3.57.1
Among others
-------
Development toolbox:
Adobe DreamWeaver 21.2
Adobe Photoshop 23.1.0
Adobe Illustrator 26.0.2
Adobe InDesign 17.0.1
Adobe XD
Visual Studio Code 1.63.2 (with some extensions enabled)
Post Reply