LeonLatex Posted September 7, 2022 Share Posted September 7, 2022 (edited) 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"> Edited September 7, 2022 by LeonLatex Quote Link to comment https://forums.phpfreaks.com/topic/315294-w3-schools-css-card-wont-center/ Share on other sites More sharing options...
Barand Posted September 8, 2022 Share Posted September 8, 2022 Define 6 hours ago, LeonLatex said: it won't center Do you mean the content of the card is not centrally aligned, or the card itself is not in the centre of an area? Quote Link to comment https://forums.phpfreaks.com/topic/315294-w3-schools-css-card-wont-center/#findComment-1600241 Share on other sites More sharing options...
LeonLatex Posted September 8, 2022 Author Share Posted September 8, 2022 It's the w3-card that won't center. There is no content in it except a w3-panel. Without the w3-panel inside it doesn't center either. Quote Link to comment https://forums.phpfreaks.com/topic/315294-w3-schools-css-card-wont-center/#findComment-1600245 Share on other sites More sharing options...
Barand Posted September 8, 2022 Share Posted September 8, 2022 1 hour ago, Barand said: Do you mean the content of the card is not centrally aligned, or the card itself is not in the centre of an area? Yes, you told us before that it won't centre. Stop repeating the same ambiguous terms and tell us what you want - A or B, or something else? Quote Link to comment https://forums.phpfreaks.com/topic/315294-w3-schools-css-card-wont-center/#findComment-1600247 Share on other sites More sharing options...
cyberRobot Posted September 8, 2022 Share Posted September 8, 2022 The classes seem to work when I paste them into the w3schools.com demo here:https://www.w3schools.com/w3css/tryit.asp?filename=tryw3css_cards_photo Are you familiar with using your browser's console to analyze the CSS rules being applied to an element on a page? If so, have you tried right-clicking the element that you expect to be centered and seeing what styles are applied to that element? That might provide a clue as to why it's not centered. Quote Link to comment https://forums.phpfreaks.com/topic/315294-w3-schools-css-card-wont-center/#findComment-1600270 Share on other sites More sharing options...
morocco-iceberg Posted October 2, 2022 Share Posted October 2, 2022 Centering elements also tends to depend on the structure of the elements and what you want to center so it's a bit difficult to deduce from a single div and no css Quote Link to comment https://forums.phpfreaks.com/topic/315294-w3-schools-css-card-wont-center/#findComment-1601256 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.