0

I have designed a quiz on html with post php. Everything is fine but i do not know how to make the results in the center of the page. The results are on the left What's the best way to do this? I'm new to PHP. I have tried

results {
    text-align: center;
    }

and 

.results
{
    text-align: center;
    }


 echo "<div id='results'>$totalCorrect / 5 correct</div>";              ?>

                </div>
            </div>
        </div>

<div class="row">
        <div class="box">
            <div class="col-lg-12">
                <hr>
                <h2 class="intro-text text-center">How did you do?
                </h2>
                <hr>

                <hr class="visible-xs">
         <?php

        $answer1 = $_POST['question-1-answers'];
        $answer2 = $_POST['question-2-answers'];
        $answer3 = $_POST['question-3-answers'];
        $answer4 = $_POST['question-4-answers'];
        $answer5 = $_POST['question-5-answers'];

        $totalCorrect = 0;

        if ($answer1 == "B") { $totalCorrect++; }
        if ($answer2 == "A") { $totalCorrect++; }
        if ($answer3 == "C") { $totalCorrect++; }
        if ($answer4 == "D") { $totalCorrect++; }
        if ($answer5) { $totalCorrect++; }

        echo "<div id='results'> $totalCorrect / 5 correct </div>";

        ?>

            </div>
        </div>
    </div>

Mikey
  • 21
  • 1
  • 3
  • Could provide more information? This is probably a html/css problem. – Mihailo Oct 15 '16 at 01:35
  • Take php out of the problem for a minute and check out [this (maybe duplicate) question](http://stackoverflow.com/questions/5703552/css-center-text-horizontal-and-vertical-inside-a-div-block). Changing the `.results` div to the full width of the page may help. –  Oct 15 '16 at 01:54

1 Answers1

0

your div has an id of results which means you call that div with

#results {
  text-align: center;
}

.results is a class

and results would be a tag if there was one. A better example would be form or body

Xanfar
  • 124
  • 6