Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML & CSS how to split page on static and scroll-able parts?

I want to split web page onto two parts. Static (top one) and scroll-able (bottom one). The problem is that solution I have creates a scroll-able box with fixed width and height. But I've seen an example of a page where bottom and right sections are limited by size of the browser screen and have scroll bars always visible. With fixed size box this will not work if screen is small. The scroll bars will be hidden.

So far I tried only HTML and CSS approach. I use Flask and Python 3 as an engine.

Here is what I already created. First is base.html and second is data_entry.html:

[CODE title="base.html"]<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="static/css/style.css">
<a href="{{ url_for('index') }}">Home</a>
<a>&nbsp;&nbsp;</a>
<a href="{{ url_for('data_entry') }}">Data entry</a>
<a>&nbsp;&nbsp;</a>
<a href="{{ url_for('help') }}">Help</a>
</head>
<body class="stop-scrolling">
{% block content %}{% endblock %}
</body>
</html>
[/CODE]

[CODE title="data_entry.html"]{% extends 'base.html' %}
{% block content %}
<h2><br>{{title}}</h2>
<br>
<h3>Searchable fields</h3>
<div style="float:top; width:2000px">
<form action="/data_entry" method="POST">
<table>
<tbody>
<tr>
...
</tr>
</tbody>
</table>
<input type="submit" class="button" value="Search">
</form>
</div>
<div style="float:bottom; width:2000px; height:400px; overflow:auto;">
<table class="tableborder">
<thead>
<tr class="tableheaderborder">
{% for h in selected_header %}
<td class="tableheaderborder"> {{ h }} </td>
{% endfor %}
</tr>
</thead>
<tbody class="tableborder">
{% for row in selected_entries %}
<tr class="tableborder">
{% for column in row %}
<td class="tableborder"> {{ column }} </td>
{% endfor %}
</tr>
{% endfor%}
</tbody>
</table>
</div>
{% endblock %}[/CODE]
 
Solution
You can use overflow: scroll; to always show the scrollbar, even if there isn't enough content to normally justify a scrollbar. You could also use vertical width and / or vertical height CSS units for determining the size of the box.

You can use overflow: scroll; to always show the scrollbar, even if there isn't enough content to normally justify a scrollbar. You could also use vertical width and / or vertical height CSS units for determining the size of the box.

 
Solution
Back
Top Bottom