Adding a featured corner to panel heading in Bootstrap - html

I am trying to add a small triangle border in the panel corners of the panel headings.
I was able to add one using this example :
Featured filled corner css
I had to make minor changes to bring it to the left. But it only "kinda" works. It wont stick on changed resolutions though.
On changed resolutions it looks like this:
My Code for the Panel:
<div class="col-lg-6">
<div class="panel">
<div class="ribbon-wrapper-featured">
<div class="featured fa"></div>
</div>
<div class="panel-heading">
<h3 class="panel-title">Select Activity Stream</h3>
</div>
<div class="panel-body">
</div>
</div>
</div>
CSS:
<style>
/*corner ribbon*/
.ribbon-wrapper-featured {
position: absolute;
top: -50px;
right: 0px;
}
.featured.fa {
width: 100px;
height: 100px;
display: block;
position: absolute;
top: 50px;
right: 10px;
}
.featured.fa::before {
position: absolute;
right: 0%;
top: 0;
margin: .25em;
color: gold;
z-index: 2;
}
.featured::after {
content: '';
position: absolute;
/* width: 0; */
/* height: 0; */
/* top: 0; */
left: -38.4em;
border-width: 20px;
border-style: solid;
border-color: #03a9f4 transparent transparent #03a9f4;
/* outline: auto; */
z-index: 1;
}
.panel-title {
background-color: #232323;
text-transform: uppercase;
font-family: 'Open Sans Condensed', sans-serif;
color: #03a9f4;
font-size: 1.5em;
padding: 0 20px 0 60px;
}
</style>
Thanks!

I haven't been able to check against different resolutions, and there might be improvements possible on the triangle:
.wrapper {
background-color: #ddd;
height: 30px;
}
.panel-heading {
height: 0;
width: 0;
border-bottom: 30px solid transparent;
border-left: 30px solid blue;
float: left;
}
h3 {
line-height: 30px;
}
<div class="wrapper">
<div class="panel-heading"></div>
<h3 class="panel-title">Select Activity Stream</h3>
</div>
Source for making triangles: https://css-tricks.com/snippets/css/css-triangle/

Related

How to make image swallowed out of window size without create blank space

this is something I built:
https://i.imagesup.co/images2/e51854cad0f72ef2900debd5518472d71713cc71.png
There is no overflow because I put in body tag overflow-x:hidden, and it's kind of "nasty" way.
I tried to set div container as width:100vw,max-width:100vw; but it's still not helping. tried to do it with a negative margin and every possible way I know but it's still create overflow like this:
https://i.imagesup.co/images2/794cf0f60d80b8a2de4f5ac44d93579bd50ace2d.png
This the relevant code of the light blue part, thanks in advance:
<body>
<div id="divStyle1">
<header>
<h1>
<span>How to <span class="importantH1">ripen Avocado</span> quickly ?</span>
<span><span class="importantH1">RFP bags</span> ripen Avocado within <span class="importantH1">12-24 hours !</span></span>
</h1>
</header>
<main>
<div id="purpuleLineBox">
<div id="purpuleLine1"> <p>100% recyclable and bio-degradable</p> </div>
<div id="purpuleLine2"> <p>Simulates the natural ripening process, organic</p> </div>
<div id="purpuleLine3"> <p>The quickest way to achieve the perfect avocado taste</p> </div>
<div id="purpuleLine4"> <p>Work with Mango, Banana, Peach, and another climacteric fruits</p> </div>
<div id="purpuleLine5"> <p>The user interface on the bag shows when an avocado is fully ripen</p> </div>
</div>
<img id="logoImg" src="Logo.png" alt="">
</main>
</div>
</body>
body {
margin: 0 auto;
}
html {
scroll-behavior: smooth;
}
#divStyle1 {
height: 90vh;
background-color: #016087;
}
h1>span {
display: block;
}
h1 {
color: white;
text-shadow: 2px 2px black;
font-size: 45px;
margin: 0 auto;
}
.importantH1 {
border-bottom: 10px solid #D52C82;
font-size: 53px;
}
.importantH1:hover {
border-bottom: 15px solid #D52C82;
font-size: 55px;
transition-duration: 0.5s;
}
#logoImg {
position: absolute;
right: -20px;
top: 10vh;
transform: rotate(8deg);
border: 20px dashed white;
padding-left: 20px;
padding-bottom: 20px;
padding-bottom: 20px;
}
#purpuleLineBox {
margin-top: 100px;
}
#purpuleLine1 {
background-color: #D52C82;
height: 50px;
width: 34%;
margin-bottom: 30px;
}
#purpuleLine2 {
background-color: #D52C82;
height: 50px;
width: 44%;
margin-bottom: 30px;
}
#purpuleLine3 {
background-color: #D52C82;
height: 50px;
width: 52%;
margin-bottom: 30px;
}
#purpuleLine4 {
background-color: #D52C82;
height: 50px;
width: 58%;
margin-bottom: 30px;
}
#purpuleLine5 {
background-color: #D52C82;
height: 50px;
width: 60%;
margin-bottom: 30px;
}
div>p {
font-size: 30px;
color: white;
text-shadow: 2px 2px black;
font-weight: bold;
margin-top: 0px;
}
This is happening due to a combination of using absolutely positioned right: -20px; and transform: rotate(8deg); if you remove the transform and set right to 0 it should not have the blank space.
If you want to keep these styles just use overflow-x: hidden;

How can I hide content I've created using the :before pseudo selector when a HTML text element is empty?

I'm creating a chat bubble with CSS and HTML.
If there is no text in the chat bubble I do not want it to display.
I can get body of the chat bubble to go away using :empty but I cannot get the triangle part of the chatbox to disappear because it was created with the pseudo selector :before and content: ' '.
My code is below. Is there anyway to make this little triangle go away if the h4 element is empty?
/* CSS talk bubble */
.myFeedback h4:empty {
display: none;
}
.talk-bubble {
margin-top: 220px;
left: 390px;
display: inline-block;
position: absolute;
width: 200px;
height: auto;
background-color: purple;
}
.round {
border-radius: 10px;
}
.tri-right.right-in:before {
content: '';
position: absolute;
width: 0;
height: 0;
left: auto;
right: -20px;
top: 38px;
bottom: auto;
border: 12px solid;
border-color: purple transparent transparent purple;
}
/* talk bubble contents */
.talktext {
padding: 10px;
text-align: center;
line-height: 1.5em;
}
.talktext p {
/* remove webkit p margins */
-webkit-margin-before: 0em;
-webkit-margin-after: 0em;
}
/* end of talk bubble stuff */
<div class="myFeedback">
<div id='guess-feedback' class="talk-bubble tri-right round right-in">
<h4 class="talktext"></h4>
</div>
</div>
/* CSS talk bubble */
h4:empty {
display: none;
}
.talk-bubble {
margin-top: 220px;
left: 390px;
display: inline-block;
position: absolute;
width: 200px;
height: auto;
background-color: purple;
}
.round{
border-radius: 10px;
}
.tri-right.right-in h4:before {
content: '';
position: absolute;
width: 0;
height: 0;
left: auto;
right: -20px;
top: 38px;
bottom: auto;
border: 12px solid;
border-color: purple transparent transparent purple;
}
/* talk bubble contents */
.talktext{
padding: 10px;
text-align: center;
line-height: 1.5em;
}
.talktext p{
/* remove webkit p margins */
-webkit-margin-before: 0em;
-webkit-margin-after: 0em;
}
/* end of talk bubble stuff */
<div class="myFeedback">
<div id='guess-feedback' class="talk-bubble tri-right round right-in">
<h4 class="talktext"></h4>
</div>
</div>
<div class="myFeedback">
<div id='guess-feedback' class="talk-bubble tri-right round right-in">
<h4 class="talktext">With Text</h4>
</div>
</div>
Change below code in your CSS
From:
.tri-right.right-in:before
To
.tri-right.right-in h4:before

How to Make Whole DIV a Link

I want to make a minimal landing page, where a whole screen is divided into 2 with text links to click through to each part of the site.
I figured out this much:
https://jsfiddle.net/m2ne5f3b/
I used 2 halves to create the divide, using a border on one side to create the line in the middle. It's super rudimentary.
.left-half {
position: absolute;
left: 0px;
width: 50%;
border-style: solid;
border-width: 1px;
border-left: none;
border-top: none;
border-bottom: none;
}
.right-half {
position: absolute;
right: 0px;
width: 50%;
}
Now what I want to do is make the whole of each half clickable, instead of the text only. Tried a couple different options to no avail. Any suggestions?
Just make the <a> the block! There is absolutely no need to use JS for this.
<a href="http://www.google.com" class="left-half">
<article>
<p>Google</p>
</article>
</a>
Then just style your <a> as a block because you are setting the height in your .left-half class, <a> elements are inline by default, so to make the height work, you need to make it a block:
.container a {
display: block;
// add any other CSS you want to apply
}
Working Snippet: Your Google looks exactly like the Youtube one in this, excelt that the whole block is now the link:
* {
box-sizing: border-box;
}
body {
font-size: 18px;
font-family: 'Cormorant Garamond', serif;
font-style: italic;
line-height: 150%;
text-decoration: none;
}
a.left-half {
height: 100%;
display: block;
}
section {
color: #000;
text-align: center;
}
div {
height: 100%;
}
article {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
padding: 20px;
}
.container {
display: table;
width: 100%;
}
.left-half {
position: absolute;
left: 0px;
width: 50%;
border-style: solid;
border-width: 1px;
border-left: none;
border-top: none;
border-bottom: none;
}
.right-half {
position: absolute;
right: 0px;
width: 50%;
}
a {
color: inherit;
text-decoration: none;
}
<section class="container">
<a href="http://www.google.com" class="left-half">
<article>
<p>Google</p>
</article>
</a>
<div class="right-half">
<article>
<p>YouTube</p>
</article>
</div>
</section>
If you do not wish to mofify your HTML structure, then you can use a pseudo to fill the entire area to be responding as the link.https://jsfiddle.net/m2ne5f3b/7/
* {
box-sizing: border-box;
}
body {
font-size: 18px;
font-family: 'Cormorant Garamond', serif;
font-style:italic;
line-height: 150%;
text-decoration: none;
}
section {
color: #000;
text-align: center;
}
div {
height: 100%;
}
article {
display:table-cell;
text-align:center;
vertical-align:middle;
}
.container {
}
.left-half {
position: absolute;
display:table;
top:0;
left: 0px;
width: 50%;
border-style: solid;
border-width: 1px;
border-left: none;
border-top: none;
border-bottom: none;
}
.right-half {
position: absolute;
top:0;
right: 0px;
width: 50%;
display:table;
}
a { color: inherit;
text-decoration: none;}
a:before {
content:'';
position:absolute;
top:0;
left:0;
right:0;
bottom:0;
}
}
<section class="container">
<div class="left-half">
<article>
<p>Google</p>
</article>
</div>
<div class="right-half">
<article>
<p>YouTube</p>
</article>
</div>
</section>
Note: if the page is meant to be 2 links side by side with little styling, then the html can be reduced to 2 links
html {
height: 100%;/* necessary for the table-layout box model demo */
width: 100%;/* necessary for the table-layout box model demo */
display: table;/* necessary for the table-layout box model demo */
table-layout: fixed;/* necessary for the table-layout box model demo */
border-collapse: collapse;
background: tomato;
}
body {
display: table-row;/* necessary for the table-layout box model demo */
}
a {
display: table-cell;/* necessary for the table-layout box model demo */
text-align: center;/* necessary for the table-layout box model demo */
vertical-align: middle;/* necessary for the table-layout box model demo */
box-shadow: 0 0 0 1px;
text-decoration: none;
color: black;
font-size: 40px
}
a:nth-child(odd) {
background: rgba(255, 114, 25, 0.5);
}
Google
YouTube
your common a tags arent going to cut it here. Your best bet is to use Javascript or jquery function calls on the divs.
<div class='left-half' onclick="fakeLink()" >
<!-- some stuff here in the div -->
</div>
then in the script file
function fakeLink() {
window.location = "http://www.yoururl.com/link";
}
* {
box-sizing: border-box;
}
body {
font-size: 18px;
font-family: 'Cormorant Garamond', serif;
font-style:italic;
line-height: 150%;
text-decoration: none;
}
section {
color: #000;
text-align: center;
}
div {
height: 100%;
}
article {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
padding: 20px;
}
.container {
display: table;
width: 100%;
}
.left-half {
position: absolute;
left: 0px;
width: 50%;
border-style: solid;
border-width: 1px;
border-left: none;
border-top: none;
border-bottom: none;
}
.right-half {
position: absolute;
right: 0px;
width: 50%;
}
a { color: inherit;
text-decoration: none;}
<section class="container">
<a href="http://www.google.com">
<div class="left-half">
<article>
<p>Google</p>
</article>
</div>
</a>
<a href="http://www.youtube.com">
<div class="right-half">
<article>
<p>YouTube</p>
</article>
</div>
</a>
</section>

Creating a title overlaying a line (CSS)

For my web app's landing page, I'm trying to create a title that appears overlaid on a dotted line (similar to this effect). This is what I currently have:
How do I create this such that the dotted line does not run through the title? I prefer to use the simplest CSS/HTML I possibly can and support the max number of browsers.
My code is pretty rudimentary. So far it is:
<h2>New Account:</h2><br>
<h2 style="margin-top:-0.5em;border:2px dashed #ffffff;border-radius:4px;color:white;display: inline-block;padding:10px 5px 5px 5px;">Choose Nickname:<br>Password:<br></h2>
With the example below you don't need to know the background color, is perfectly scalable, the dots extend to the remaining space of the title.
Actually, the title can wrap on multiple lines.
Feel free to tweak it to your needs and don't forget to prefix.
dotted-container {
border: 2px dotted red;
border-top-width: 0;
margin: 2rem 1rem;
display: block;
}
dotted-container>.content {
padding: 1rem;
}
dotted-title {
display: flex;
align-items: center;
height: 2px;
margin: 0 2px;
}
dotted-title > span {
padding: 0 1rem;
}
dotted-title:after,
dotted-title:before {
border-top: 2px dotted red;
content: '';
display: inline-block;
height: 0;
flex:1;
}
<dotted-container>
<dotted-title>
<span>title</span>
</dotted-title>
<div class="content">
Actual content
</div>
</dotted-container>
<dotted-container>
<dotted-title>
<span>some other title</span>
</dotted-title>
<div class="content">
Some other actual content
</div>
</dotted-container>
<dotted-container>
<dotted-title>
<span>and here's a title<br /> on two lines</span>
</dotted-title>
<div class="content">
Some content for a title on two lines.
</div>
</dotted-container>
Of course, you might want to adjust the margin/padding to your own liking and to accommodate any title wrapping on more than one line.
If you want to replace the "crappy" dotted line with a true dotted one, here's an example. Read the blog post to understand it.
Another good write-up on border-image property here.
Also note you don't have to use custom tags, as I did. It's an example. You may use classes or any other selectors that work for your specific case.
And here's an SCSS script I made you can use to pass in your selectors and desired margin/padding values. Far from perfect, but seems to do the trick:
$border-width: 2px;
$border-style: dotted;
$border-color: red;
$container: 'dotted-container';
$title: 'dotted-title';
$content:'.content';
$padding: 2rem;
$margin: 1rem;
$title-padding-value: 3;
$title-padding-unit:rem;
#{$container} {
border: $border-width $border-style $border-color;
border-top-width: 0;
margin: #{$title-padding-value/2}#{$title-padding-unit} $margin $margin $margin;
display: block;
> #{$content} {
padding: #{$title-padding-value/2}#{$title-padding-unit} $padding $padding $padding;
}
#{$title} {
display: flex;
align-items: center;
height: $border-width;
margin: 0 $border-width;
> span {
padding: 0 $padding;
}
&:after,
&:before {
border-top: $border-width $border-style $border-color;
content: '';
display: inline-block;
height: 0;
flex: 1;
}
}
}
Here's a solution with a combination of pseudo elements, flexbox, and absolute positioning.
* {
margin:0;padding:0;
box-sizing:border-box;
}
body {
background: url('https://s-media-cache-ak0.pinimg.com/originals/33/3b/4f/333b4f22ae39d1aaf8c23d77e759d8e1.jpg') 0 0 no-repeat / cover;
}
h2:before,h2:after {
content: '';
bottom: 50%;
border-top: 3px dotted black;
flex: 1 0 0;
}
h2:before {
margin-right: 1em;
}
h2:after {
margin-left: 1em;
}
h2 {
display: flex;
align-items: center;
font-size: 3em;
position: absolute;
top: 0; left: 0; right: 0;
transform: translateY(calc(-50% + 1px));
text-shadow: 0 3px 0 #fff;
}
section {
border: dotted black;
border-width: 0 3px 3px;
position: relative;
width: 80%;
margin: 3em auto;
padding-top: 3em;
background: rgba(255,255,255,0.5);
}
<section>
<h2>New Account:</h2>
<p>foo</p>
<p>foo</p>
<p>foo</p>
</section>
You can use a combination of z-index and background-color, as shown in the snippet below:
z-index pulls the New Account: title in front, then the background-color hides the border behind the it
body {
background: green;
}
#one {
position: absolute;
left: 35px;
z-index: 1;
background: green;
display: inline-block;
color: white;
}
#two {
position: absolute;
z-index: -1;
top: 55px;
margin-top: -0.5em;
border: 2px dashed white;
border-radius: 4px;
color: white;
display: inline-block;
padding: 10px 5px 5px 5px;
}
<h2 id="one">New Account:</h2><br>
<h2 id="two">Choose Nickname:<br>Password:<br></h2>
Perhaps you can do something like this:
* {
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.box {
background: green;
padding: 15px;
width: 250px;
height: 250px;
}
.inner-box {
border: 1px dotted #ffffff;
height: 100%;
position: relative;
-webkit-border-radius: 7px;
border-radius: 7px;
}
.inner-box p {
position: absolute;
width:70%;
text-align: center;
top: -25px;
left: 50%;
-webkit-transform: translateX(-50%);
transform: translateX(-50%);
color: #ffffff;
display: block;
background: green; /* Make it the same as background color */
}
<div class="box">
<div class="inner-box">
<p>My Awesome Title</p>
</div>
</div>
I would suggest having a background colour on the "New Account" if the background is only one colour, that way the dotted line will not be seen as it is covered by the background colour.
The code snippet shows how this can be adjusted to show more or less of the dotted border either side of the title.
.parent{
background-color: green;
position: relative;
font-size: 14px;
}
.parent h2:first-child{
color: #fff;
text-align: center;
z-index: 1;
background-color: green;
position: absolute;
left: 20px;
padding: 0 5px;
}
.parent h2:last-child{
margin-top: 15px;
z-index: 0;
}
.parent_two h2:first-child{
left: 12px;
padding: 0 17px;
}
<div class='parent'>
<h2>New Account:</h2><br>
<h2 style="border:2px dashed #ffffff;border-radius:4px;color:white;display: inline-block;padding:10px 5px 5px 5px;">Choose Nickname:<br>Password:<br></h2>
</div>
<div class='parent_two parent'>
<h2>New Account:</h2><br>
<h2 style="border:2px dashed #ffffff;border-radius:4px;color:white;display: inline-block;padding:10px 5px 5px 5px;">Choose Nickname:<br>Password:<br></h2>
</div>
I would move the title up with absolute positioning (just make sure the parent is relative positioned), wrap the title text in a <span> and then add padding and matching background color to that <span>.
body {
margin: 0;
background-color: green;
}
.box {
position: relative;
margin: 1rem;
padding: 1rem;
color: white;
box-sizing: border-box;
border: 1px dashed white;
}
.box-title {
position: absolute;
top: -1rem;
left: 0;
margin: 0;
width: 100%;
text-align: center;
font-size: 1.5rem;
}
.box-title>span {
padding: 0 1rem;
background-color: green;
}
<div class="box">
<h2 class="box-title"><span>New Account:</span></h2>
<p>Username:</p>
<p>Password:</p>
</div>
FWIW, I don't typically care for extra markup but if I have to work extra hard to make it work some other way then I find it acceptable. Especially when it's super simple.
body{
background: url('https://placeholdit.imgix.net/~text?txtsize=33&txt=350%C3%97150&w=750&h=350') center top 0 no-repeat / cover;
}
.wrapper {
max-width: 400px;
margin: 30px auto 0;
border: 2px dotted red;
height: 200px;
border-top: 0;
text-align: center;
}
.heading {
display: table;
width: 100%;
position: relative;
}
.heading:before {
content: '';
display: table-cell;
border-top: 2px dotted red;
}
.heading:after {
content: '';
display: table-cell;
border-top: 2px dotted red;
}
.txt-wrapper {
display: table-cell;
width: 1%;
white-space: nowrap;
line-height: 0;
padding: 0 10px;
}
<div class="wrapper">
<div class="heading">
<h2 class="txt-wrapper">
This is heading
</h2>
</div>
<P>
This is paragraph.
</P>
<P>
This is another paragraph.
</P>
</div>

CSS Property "overflow-y: auto" causing very unexpected results

The following code is part of a custom 404 page I am planning on using on a website of mine. However there is a major problem when I add the line of code overflow-y: auto;
The code below has the output which I expected it to. However when it the code inside the div reaches more than 75vh the overflow is not visible.
* {
margin: 0;
padding: 0;
}
.main {
min-height: 100vh;
font-size: 1em;
overflow-Y: hidden;
}
.center {
float: left;
position: relative;
left: 50%;
}
.wrap {
width: 100%;
float: left;
position: relative;
left: -50%;
}
.load_extra {
display: block;
position: fixed;
z-index: 11;
bottom: 15px;
}
.prep {
align: center;
background: #00eaff;
outline: none;
padding: 8px;
color: white;
border-color: white;
border-style: dotted;
border-width: 3px;
border-radius:50%;
font-size: 1.375em;
}
.extra {
display: block;
position: fixed;
bottom: 10px;
max-height: 75vh;
width: 80vw;
z-index: 10;
}
pre {
font-family: monospace, monospace;
font-size: 0.85em;
display: block;
overflow-y: auto;
word-break: break-all;
white-space:normal;
padding: 10px;
margin: 0 0 10px;
line-height: 1.42857143;
color: #333;
word-break: break-all;
word-wrap: break-word;
background-color: #f5f5f5;
border: 1px solid #ccc;
border-radius: 4px;
max-height: 50vh;
}
<body class="main">
<div class="center load_extra">
<div class="wrap">
<button id="extra" class="prep">Button</button>
</div>
</div>
<div id="infoCont" class="center extra">
<div class="wrap">
<h1>Extra Information</h1>
<pre>Some URL</pre>
<p>The requested URL shown above could not be found on the server</p>
<hr>
</div>
</div>
</body>
In order to fix this problem I added the line overflow-y: auto; in .extra class. This is what caused a problem. When you run the code below half of the output is "missing". I am unsure of why this is occuring.
* {
margin: 0;
padding: 0;
}
.main {
min-height: 100vh;
font-size: 1em;
overflow-Y: hidden;
}
.center {
float: left;
position: relative;
left: 50%;
}
.wrap {
width: 100%;
float: left;
position: relative;
left: -50%;
}
.load_extra {
display: block;
position: fixed;
z-index: 11;
bottom: 15px;
}
.prep {
align: center;
background: #00eaff;
outline: none;
padding: 8px;
color: white;
border-color: white;
border-style: dotted;
border-width: 3px;
border-radius:50%;
font-size: 1.375em;
}
.extra {
display: block;
position: fixed;
bottom: 10px;
max-height: 75vh;
width: 80vw;
z-index: 10;
overflow-y: auto;
}
pre {
font-family: monospace, monospace;
font-size: 0.85em;
display: block;
overflow-y: auto;
word-break: break-all;
white-space:normal;
padding: 10px;
margin: 0 0 10px;
line-height: 1.42857143;
color: #333;
word-break: break-all;
word-wrap: break-word;
background-color: #f5f5f5;
border: 1px solid #ccc;
border-radius: 4px;
max-height: 50vh;
}
<body class="main">
<div class="center load_extra">
<div class="wrap">
<button id="extra" class="prep">Button</button>
</div>
</div>
<div id="infoCont" class="center extra">
<div class="wrap">
<h1>Extra Information</h1>
<pre>Some URL</pre>
<p>The requested URL shown above could not be found on the server</p>
<hr>
</div>
</div>
</body>
I would appreciate any help in fixing this problem.
Half of the output goes "missing" due to the left positions defined in center and wrap classes.
center class will position your container starting from 50% and then, the inner container (wrap) gets repositioned again with -50%. Since the overflow is applied on the parent div, half of the content is no longer visible.
One solution might be to move overflow-y: auto; to wrap class.
Another is to choose another way to center infoCont div.
<div id="infoCont" class="extra">
<h1>Extra Information</h1>
<pre>Some URL</pre>
<p>The requested URL shown above could not be found on the server</p>
<hr>
</div>
.extra {
display: block;
position: fixed;
bottom: 10px;
max-height: 75vh;
width: 80vw;
z-index: 10;
overflow-y: auto;
margin: 0 auto; /* set margin to auto */
left: 0; /* set also left and right because position is fixed */
right: 0;
}
See working example.