title: Footer section showing on top of the page in flask conditional rendering
body: <p>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 <a href="https://i.stack.imgur.com/htshC.png" rel="nofollow noreferrer">&quot;footeratbottom&quot;</a> it looks.</p>
  <pre><code>&lt;!DOCTYPE html&gt;
  
  &lt;html &gt;
  &lt;head&gt;
   &lt;meta charset=&quot;UTF-8&quot;&gt;
   
   &lt;!-- Make it compatible to mobile devices --&gt;
   &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;
   
   &lt;title&gt;Diabetes Risk Prediction&lt;/title&gt;
   &lt;link rel=&quot;preconnect&quot; href=&quot;https://fonts.googleapis.com&quot;&gt;
   &lt;link rel=&quot;preconnect&quot; href=&quot;https://fonts.gstatic.com&quot; crossorigin&gt;
   &lt;link href=&quot;https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@300;400;600;700&amp;display=swap&quot; rel=&quot;stylesheet&quot;&gt;
   &lt;link rel=&quot;stylesheet&quot; href=&quot;{{ url_for('static',filename='css/style.css') }}&quot;&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
     &lt;main class=&quot;result-main&quot;&gt;   
     {% if result == &quot;Positive&quot;: %}
         &lt;p class=&quot;danger&quot;&gt;You have high risk of type-2 diabetes. See a doctor immediately!&lt;/p&gt;
         &lt;p class=&quot;resources&quot;&gt;Check out these resources to learn more about diabetes&lt;/p&gt;
         &lt;ul&gt;
             &lt;li&gt;&lt;a href=&quot;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.&quot;&gt;
                 Difference between type-1 and type-2 diabetes&lt;/a&gt;&lt;/li&gt;
             &lt;li&gt;&lt;a href=&quot;https://www.niddk.nih.gov/health-information/diabetes/overview/managing-diabetes&quot;&gt;Managing diabetes&lt;/a&gt;&lt;/li&gt;
             &lt;li&gt;&lt;a href=&quot;https://www.webmd.com/diabetes/diabetes-lifestyle-tips&quot;&gt;Lifestyle changes to help control your diabetes&lt;/a&gt;&lt;/li&gt;
         &lt;/ul&gt;
     {% elif result == &quot;Negative&quot; %}
         &lt;p class=&quot;out-of-danger&quot;&gt;You have no risk of diabetes. Keep up the healthy habits!&lt;/p&gt;
         &lt;p class=&quot;resources&quot;&gt;These resources might help you keep the diabetes away&lt;/p&gt;
         &lt;ul&gt;
             &lt;li&gt;&lt;a href=&quot;https://www.mayoclinic.org/diseases-conditions/type-2-diabetes/in-depth/diabetes-prevention/art-20047639&quot;&gt;Diabetes prevention&lt;/a&gt;&lt;/li&gt;
             &lt;li&gt;&lt;a href=&quot;https://www.healthline.com/nutrition/prevent-diabetes&quot;&gt;11 Ways to Prevent Type 2 Diabetes&lt;/a&gt;&lt;/li&gt;
         &lt;/ul&gt;
     {% endif %}
     &lt;/main&gt;
     &lt;footer&gt;
         &lt;p&gt;He who has health, has hope; and he who has hope, has everything - Thomas Carlyle&lt;/p&gt;
     &lt;/footer&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  ```[&quot;footerontop&quot;](https://i.stack.imgur.com/RqGiY.png)
  
  
   [1]: https://i.stack.imgur.com/htshC.png
   [2]: https://i.stack.imgur.com/RqGiY.png
  </code></pre>