The CSS does not work as needed. To see the entire viewing area, I have to set my browser at 80%. I need a complete replacement that looks at the screen resolution and sets the viewing panel to the browser width. The Image panel needs to be 75% of the viewing panel width and the text panel to 25%. We need a scroll bar on the text panel.
- {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
box-sizing: border-box;
overflow: hidden;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.container {
display: flex;
flex-direction: column;
height: 100vh;
width: 100vw;
}
.header {
flex: 0 0 auto;
padding: 10px;
text-align: center;
background: rgba(255, 255, 255, 0.8);
}
.header h1 {
color: #333;
font-size: 2em;
font-weight: 300;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.content {
flex: 1 1 auto;
display: flex;
overflow: hidden;
}
.panel {
height: 100%;
display: flex;
flex-direction: column;
padding: 10px;
overflow: hidden;
}
.panel:nth-child(1) {
width: 75%;
}
.panel:nth-child(2) {
width: 25%;
}
.panel h2 {
color: #444;
margin-bottom: 5px;
font-size: 1.5em;
font-weight: 400;
text-align: center;
border-bottom: 1px solid #f0f0f0;
padding-bottom: 5px;
}
.image-container {
flex: 1;
background: #f8f9fa;
display: flex;
justify-content: center;
align-items: center;
border: 1px dashed #ddd;
overflow: auto;
}
.image-container.has-image {
background: transparent;
border: none;
}
.image-container img {
max-width: 100%;
max-height: 100%;
border-radius: 5px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.placeholder {
color: #999;
font-size: 1em;
text-align: center;
}
.text-container {
flex: 1;
background: #f8f9fa;
border: 1px solid #e9ecef;
border-radius: 5px;
padding: 10px;
overflow-y: auto;
}
.text-container::-webkit-scrollbar {
width: 8px;
}
.text-container::-webkit-scrollbar-track {
background: #e9ecef;
border-radius: 4px;
}
.text-container::-webkit-scrollbar-thumb {
background: #667eea;
border-radius: 4px;
}
.text-container::-webkit-scrollbar-thumb:hover {
background: #764ba2;
}
.text-content {
color: #333;
line-height: 1.5;
font-size: 1em;
white-space: pre-wrap;
word-wrap: break-word;
}
.controls {
flex: 0 0 auto;
padding: 10px;
background: rgba(255, 255, 255, 0.7);
display: flex;
justify-content: space-around;
align-items: center;
gap: 10px;
}
.page-input {
display: flex;
align-items: center;
gap: 5px;
font-size: 1em;
color: #444;
}
.page-input input {
width: 60px;
padding: 5px;
border: 1px solid #ddd;
border-radius: 5px;
text-align: center;
font-size: 1em;
transition: border-color 0.2s ease;
}
.page-input input:focus {
outline: none;
border-color: #667eea;
box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}
.nav-btn {
background: linear-gradient(135deg, #667eea, #764ba2);
color: white;
border: none;
padding: 5px 10px;
border-radius: 5px;
cursor: pointer;
font-size: 1em;
transition: all 0.2s ease;
box-shadow: 0 2px 5px rgba(102, 126, 234, 0.2);
}
.nav-btn:hover {
transform: translateY(-1px);
box-shadow: 0 3px 7px rgba(102, 126, 234, 0.3);
}
.nav-btn:active {
transform: translateY(0);
}
.nav-btn:disabled {
background: #ccc;
cursor: not-allowed;
transform: none;
box-shadow: none;
}
.error {
color: #e74c3c;
text-align: center;
font-style: italic;
}
@media (max-width: 768px) {
.content {
flex-direction: column;
}
.panel {
width: 100%;
min-height: 50vh;
}
.panel:nth-child(1) { /* Image panel */
width: 100%;
}
.panel:nth-child(2) { /* Text panel */
width: 100%;
}
.header h1 {
font-size: 1.5em;
}
.controls {
flex-wrap: wrap;
justify-content: center;
}
}
@media (min-width: 769px) {
.content {
flex-direction: row;
}
.panel:nth-child(1) { /* Image panel */
width: 75%;
}
.panel:nth-child(2) { /* Text panel */
width: 25%;
}
}
@media (max-height: 600px) {
.header h1 {
font-size: 1.2em;
}
.panel h2 {
font-size: 1.2em;
}
.text-content {
font-size: 0.9em;
}
.controls {
padding: 5px;
}
.nav-btn, .page-input input {
font-size: 0.9em;
padding: 4px 8px;
}
}
Here is the HTML:
<div class="content">
<div class="panel">
<h2>Image</h2>
<div class="image-container" id="imageContainer">
<div class="placeholder">No image loaded</div>
</div>
</div>
<div class="panel">
<h2>Text</h2>
<div class="text-container" id="textContainer">
<div class="text-content" id="textContent">
<div class="placeholder">No text loaded</div>
</div>
</div>
</div>
</div>
<div class="controls">
<button class="nav-btn" id="prevBtn">◀ Previous</button>
<div class="page-input">
<label for="pageNumber">Page</label>
<input type="number" id="pageNumber" value="1" min="1">
</div>
<button class="nav-btn" id="nextBtn">Next ▶</button>
<button class="nav-btn" id="refreshBtn">🔄 Refresh</button>
</div>
</div>
<script src="script.js"></script>