Tagged: h2, h3, headings, mobile, target page-id-, text-align
Hi
I am trying to center my h2 and h3 headings on mobile, but keep the left align on page-id-446 only.
I tried this code but it’s not quite right – can you help with this?
@media only screen and (max-width: 767px) {
h3 {
text-align: center!important;
}
h2 {
text-align: center!important;
}
.page-id-446 h2, h3 {
text-align: left!important;
}}
thanks
Nancy
Hey Munford,
I can’t see your CSS applying at all, please post admin WordPress login details in private if you should need any further help.
The first page you linked to gives a 404 error on my end.
Best regards,
Rikard
I took it off temporarily since it was effecting the mobile footer and other pages h3 headings. New code is here:
@media only screen and (max-width: 767px) {
h3 {
text-align: center!important;
}
h2 {
text-align: center!important;
}
.page-id-503 h2, h3 {
text-align: left!important;
}}
Check it now on the pages below
It looks like on the mobile that all the h3 are left aligned on all pages, instead of just on page 503
Hi,
With this css that you added, the H3 will be for all pages:
.page-id-503 h2, h3 {
text-align: left!important;
}}
if you want this css to say H3 for only page 503 then you should write it like this:
.page-id-503 h2, .page-id-503 h3 {
text-align: left!important;
}}
I would recommend using css that has enough specifically to not require !important;, like this:
@media only screen and (max-width: 767px) {
#main.all_colors h3 {
text-align: center;
}
#main.all_colors h2 {
text-align: center;
}
.page-id-503 #main.all_colors h2,.page-id-503 #main.all_colors h3 {
text-align: left;
}
}
Best regards,
Mike
thanks – that worked
you can close this