Log in

View Full Version : Resolved Not Centering



marain
06-23-2013, 03:05 PM
Good morning (or, for you blokes across the pond, afternoon) folks. Here's my stumper du jour:

The following code is not centering:


<center><h2>Eviction from Residential Premises</h2></center>

I've tested this in (a very early edition of) Firefox, as well as in relatively up-to-date Google Chrome. w3c testing comes back clean. The page, should anyone care to see it, is http://www.njmarijuana.com/page.php?here=housing.

Comments welcome.

A.

ajfmrf
06-23-2013, 03:46 PM
In the css file here:
<link rel="stylesheet" type="text/css" href="css/njmarijuana.css" />
you have the h2 heading set as:
h2 { text-align:left; font-size:large; }

Try changing that to center and remove those center tags.

My test page is here:
http://www.web-user.info/test/pot/page.php

It seems to have centered those h2 headings as you were trying to do.

jscheuer1
06-23-2013, 04:00 PM
That would work but would also center text in all other h2 elements. That may or may not be desirable.

If it's not, you could make up a class in the stylesheet:


.center {
text-align: center;
}

Then in the markup get rid of the center tags again, and add the class:


<h2 class="center">Eviction from Residential Premises</h2>

marain
06-23-2013, 05:30 PM
Now why didn't I think of that? Problem solved. Thanks, folks.

A.