Footer section showing on top of the page in flask conditional rendering

Viewed 36

I have a very simple flask conditional rendering in the main tag and a footer tag below it. However, the footer is shown at top of the page. The position of the footer is okay on other pages without flask conditional rendering, please have a look at the code and how "footeratbottom" it looks.

<!DOCTYPE html>

<html >
<head>
 <meta charset="UTF-8">
 
 <!-- Make it compatible to mobile devices -->
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 
 <title>Diabetes Risk Prediction</title>
 <link rel="preconnect" href="https://fonts.googleapis.com">
 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
 <link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400;600;700&display=swap" rel="stylesheet">
 <link rel="stylesheet" href="{{ url_for('static',filename='css/style.css') }}">
</head>

<body>
   <main class="result-main">   
   {% if result == "Positive": %}
       <p class="danger">You have high risk of type-2 diabetes. See a doctor immediately!</p>
       <p class="resources">Check out these resources to learn more about diabetes</p>
       <ul>
           <li><a href="https://canohealth.com/news/blog/the-difference-between-type-1-and-type-2-diabetes/#:~:text=Type%201%20diabetes%20is%20caused,to%20lower%20the%20blood%20sugars.">
               Difference between type-1 and type-2 diabetes</a></li>
           <li><a href="https://www.niddk.nih.gov/health-information/diabetes/overview/managing-diabetes">Managing diabetes</a></li>
           <li><a href="https://www.webmd.com/diabetes/diabetes-lifestyle-tips">Lifestyle changes to help control your diabetes</a></li>
       </ul>
   {% elif result == "Negative" %}
       <p class="out-of-danger">You have no risk of diabetes. Keep up the healthy habits!</p>
       <p class="resources">These resources might help you keep the diabetes away</p>
       <ul>
           <li><a href="https://www.mayoclinic.org/diseases-conditions/type-2-diabetes/in-depth/diabetes-prevention/art-20047639">Diabetes prevention</a></li>
           <li><a href="https://www.healthline.com/nutrition/prevent-diabetes">11 Ways to Prevent Type 2 Diabetes</a></li>
       </ul>
   {% endif %}
   </main>
   <footer>
       <p>He who has health, has hope; and he who has hope, has everything - Thomas Carlyle</p>
   </footer>
</body>
</html>

```["footerontop"](https://i.stack.imgur.com/RqGiY.png)


 [1]: https://i.stack.imgur.com/htshC.png
 [2]: https://i.stack.imgur.com/RqGiY.png
0 Answers
Related