Edrol97
Silver Coder
Hi all,
Is there a way to set the default setting of the pdf viewer on load to fit-to-width rather than fit-to page?
Thanks,
Eliot
Is there a way to set the default setting of the pdf viewer on load to fit-to-width rather than fit-to page?
Thanks,
Eliot
Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>The Context by Context Cast News</title>
<link rel="stylesheet" href="Style.css" />
<link
rel="icon"
type="image/x-icon"
href="/Users/eliot/Desktop/ContextCastNewsWeb/Fav.svg"
/>
<style>
/* Responsive PDF viewer styles */
.pdf-container {
width: 100%;
max-width: 1200px;
margin: 0 auto;
padding: 20px;
box-sizing: border-box;
}
.pdf-container object {
width: 80%;
border: 1px solid #ddd;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
/* Large screens (desktops) */
@media screen and (min-width: 1200px) {
.pdf-container object {
min-height: 1000px;
}
}
/* Medium screens (tablets landscape) */
@media screen and (max-width: 1199px) and (min-width: 992px) {
.pdf-container object {
min-height: 900px;
}
}
/* Tablets portrait */
@media screen and (max-width: 991px) and (min-width: 768px) {
.pdf-container {
padding: 15px;
}
.pdf-container object {
min-height: 700px;
}
}
/* Mobile devices */
@media screen and (max-width: 767px) {
.pdf-container {
padding: 10px;
}
.pdf-container object {
min-height: 500px;
}
}
/* Small mobile devices */
@media screen and (max-width: 480px) {
.pdf-container {
padding: 5px;
}
.pdf-container object {
min-height: 400px;
}
}
</style>
</head>
<body>
<header>
<div class="header-content">
<div class="logo-section">
<a href="Context.html" style="text-decoration: none; color: #000">
<img
style="margin: auto; display: block"
src="/Users/eliot/Desktop/ContextCastNewsWeb/TheContextWeb.png"
width="50%"
alt="Logo"
/>
<h1 style="text-decoration: none; font-family: Montserrat">
By Context Cast News
</h1>
</a>
</div>
</div>
</header>
<nav>
<a href="index.html">Home</a>
<a href="History.html">History</a>
<a href="Contributors.html">Contributors</a>
<a href="Context.html" class="active">Context</a>
<a href="mailto:[email protected]">Contact</a>
</nav>
<div class="body">
<h1 style="text-decoration: none">Read the first edition</h1>
<h2>And if you're impressed sign up for more</h2>
<a
href="https://docs.google.com/forms/d/e/1FAIpQLScIok0lA2eXsNhx-isZmrRAu9BkQxGhuN9cgUgwDRkK2ZMpaw/viewform"
target="_blank"
>
<h1
style="
font-weight: bold;
background-color: #012169;
color: white;
padding: 2%;
text-align: center;
"
>
Enter your details for your free print copy of the magazine every
quarter
</h1></a
>
<h2>
<br />
<b>The Latest Edition</b>
<br />
<br />
Featuring Lord Prem Sikka PhD, David Starkey CBE, The Right Honourable
Sir John Redwood and Kevin Dent KC.
</h2>
<div class="pdf-container">
<object data="CCNews19.10.2025.pdf" type="application/pdf">
<p>
Alternative text - include a link
<a href="CCNews19.10.2025.pdf">to the PDF!</a>
</p>
</object>
</div>
</div>
<footer>
<div class="footertop">
<a href="index.html">Home</a>
<a href="History.html">History</a>
<a href="Contributors.html">Contributors</a>
<a href="Context.html" class="active">Context</a>
<a href="mailto:[email protected]">Contact</a>
</div>
<br />
<h2>
© Context Cast News 2025. Design by
<a href="https://www.house-of-lord.co.uk">Eliot Lord</a>
</h2>
</footer>
</body>
</html>
CSS:
html {
height: 100%;
}
body {
margin: 0;
padding: 0;
font-family: Arial, Helvetica, sans-serif;
background-color: #f4f4f0;
min-height: 100vh;
display: flex;
flex-direction: column;
text-align: center;
overflow-x: hidden;
-webkit-user-drag: none;
}
img {
-webkit-user-drag: none;
}
body > *:not(footer) {
width: 80%;
margin-left: auto;
margin-right: auto;
}
body::-webkit-scrollbar {
width: 1em round;
overflow: scroll;
}
body::-webkit-scrollbar-track {
box-shadow: inset 0 0 6px #012169;
}
body::-webkit-scrollbar-thumb {
background-color: #012169;
outline: 1px solid #012169;
width: 1em round;
border-radius: 10px;
}
::selection {
background-color: #012169;
color: white;
}
nav,
h1,
h2 {
overflow: hidden;
margin: auto;
display: block;
width: 60%;
text-align: center;
}
h1 {
text-decoration: underline;
font-size: clamp(18px, 2dvw, 32px);
}
h2 {
font-size: clamp(14px, 1.2dvw, 24px);
}
h2 a {
color: #c8102e;
}
h2 a:hover {
color: #012169;
font-weight: 900;
}
h1 a:hover {
color: #ecd53e;
}
nav {
padding-top: 2%;
padding-bottom: 5%;
}
nav a {
padding: 10px 5px;
font-size: clamp(14px, 1.5dvw, 24px);
text-align: center;
text-decoration: none;
color: #000;
}
nav a:hover {
background-color: #c8102e;
color: white;
text-decoration: underline;
}
.active {
background-color: #c8102e;
color: white;
text-decoration: underline;
}
.column {
display: inline-block;
width: 48%;
padding: 10px;
height: 300px;
vertical-align: top;
box-sizing: border-box;
}
.column:first-of-type {
margin-right: 2%;
}
.bios-container {
width: 90%;
margin: 2% auto;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
gap: 2%;
}
.bio-item {
width: 31.33%;
text-align: center;
margin-bottom: 3%;
}
.bio-item img {
width: 50%;
display: block;
margin: 0 auto 1rem auto;
}
bio-item h1 {
width: 100%;
text-align: center;
}
.bio-item h2 {
width: 100%;
text-align: center;
}
/* Main content wrapper */
main {
flex: 1;
}
/* Footer pinned to bottom */
footer {
font-size: clamp(12px, 2dvw, 24px);
padding: 1rem 0;
margin-top: auto;
width: 60vw;
position: relative;
margin: auto;
}
footer a {
color: black;
text-decoration: none;
}
footer a:hover {
background-color: #c8102e;
text-decoration: underline;
color: white;
}
object {
width: 100%;
height: 80vh;
min-height: 600px;
max-height: 1200px;
display: block;
margin: 2% auto;
}
/* Responsive adjustments */
@media screen and (max-width: 768px) {
body > *:not(footer) {
width: 90%;
}
nav,
h1,
h2 {
width: 90%;
}
.bios-container {
width: 90%;
}
.column {
width: 100%;
margin-right: 0 !important;
height: auto;
margin-bottom: 20px;
}
.bio-item {
width: 100%;
}
object {
height: 70vh;
min-height: 400px;
}
}
@media screen and (max-width: 480px) {
body > *:not(footer) {
width: 95%;
}
nav,
h1,
h2 {
width: 95%;
}
.bios-container {
width: 95%;
}
nav {
padding-top: 5%;
padding-bottom: 8%;
}
nav a {
display: block;
margin-bottom: 5px;
padding: 8px;
}
object {
height: 60vh;
min-height: 300px;
}
}