CSS: print long div inside modal, no second page in IE - css

I'm working on a new version of the project and I'm having some problems with the print CSS style.
here the old project:
https://www.traffwebdemo.co.uk/parking/main.html
STEPS TO PRINT:
Click on the wrench button -> printer button -> choose the template, a modal will open and then you can print on both orientation, it's done with an iframe and a mix of 2 css, one in the main project and one in the iframe itself.
the css print hide everything and show just the modal content when it print, so if you try to print directly on the main page you will have just a white page.
I'm not working anymore with the iframe due to limitation with the map, i'm still calling the html template but then I'm cloning the body of it in the modal and get rid again of the iframe.
here the new version:
https://www.traffwebdev.uk/parking/test.html
Both version of the project use Bootstrap but while the old version calls an iframe and I print the iframe bootstrap is not loaded, the new way get rid of the iframe so Bootstrap is interfering with the print.
I was having problem with the orientation field in Chrome and no second page in all the other browsers but after digging into Bootstrap issues I found that this can be solved overwriting the CSS rule with
#page {
size: auto
}
.flex-class {
display: block;
}
Now I have second page in Firefox and Opera but...sadly our clients use IE11... and I don't have second page in IE
How can I print both pages in IE? It seems that these rules are completely ignores.
#pllegwrapper {
page-break-inside: avoid !important;
break-inside: avoid !important;
}
#pagesplit {
display: block;
page-break-before: always !important;
break-before: page !important;
}
UPDATE
I've applied display: table to the main div that contain the 2 pages and now I can print in IE but not in FF.

Just make your model's position as relative.
http://plnkr.co/edit/fspygnqWhsosqDTds0Og?p=preview
/**Modal Styles for Print**/
#media print {
body * {
visibility: hidden;
}
#print-content * {
visibility: visible;
overflow: visible;
}
#mainPage * {
display: none;
}
.modal {
margin: 0;
padding: 0;
min-height: 550px;
visibility: visible;
/**Remove scrollbar for printing.**/
overflow: visible !important;
position: relative;
}
.modal-dialog {
visibility: visible !important;
/**Remove scrollbar for printing.**/
overflow: visible !important;
}

I manage to fix the problem with the code below, #printMod is the bootstrap modal itself, i remove any flex property and float.
Then I've applied display: table to #printMod and #printBody, this last one is the main container inside the .modal-body modal element.
Quite a long work to fix it and just because of Bootstrap.
#media print {
#page {
size: auto;
}
body {
margin:0 !important;
padding:0 !important;
height:100% !important;
width: 100% !important;
}
body * {
visibility: hidden;
}
#printMod,
#printMod * {
visibility: visible;
float: none;
display: block;
flex: none !important;
}
#printBody {
display: table !important;
margin: auto !important;
}
#printMod {
& {
display: table !important;
position: absolute;
left: 0;
top: 0;
padding: 0 !important;
margin: 0 !important;
width: 100% !important;
break-inside: auto;
border: none !important;
overflow: visible !important;
}
.modal-header,
.modal-footer {
display: none;
border: none !important;
}
.modal-dialog,
.modal-content,
.modal-body {
display: block;
overflow: visible;
height: 100% !important;
max-height: 100% !important;
padding: 0;
border: none !important;
}
#plwrapper,
#pllegwrapper {
page-break-inside: avoid !important;
break-inside: avoid !important;
}
#pagesplit {
display: block;
page-break-before: always !important;
break-before: page !important;
}
}
}

Related

White box appearing at the bottom of the page when using antd Modal on mobile Firefox

I am using antd with React. I have a couple of Modals in my code. They work perfectly fine on web Chrome and Firefox as well as on mobile Chrome. However when using Firefox on mobile, I get a white box at the bottom of the page. Any ideas?
.ant-layout {
min-height: 100vh;
background: #background;
padding: 0 1.8em 1.5em 1.8em;
}
.ant-layout-content {
padding: 0 2em 1.5em 2em;
}
#media only screen and (max-width: 730px) {
.ant-layout-content {
padding: 0;
}
}
header.ant-layout-header {
padding: 0;
margin-bottom: 2em;
background-color: transparent;
color: white;
}
footer.ant-layout-footer {
display: flex;
flex-direction: row;
justify-content: center;
background-color: #primary;
color: #white;
text-align: center;
}
.ant-modal-body {
max-height: calc(100vh - 210px);
overflow-y: auto;
}
.ant-modal-body::-webkit-scrollbar {
width: 12px;
}
By default when ant design renders Modals. It renders them inside <Body />. Which could create an issue with overflow. Try to render modal inside, the first child of the body element (it could be #root). It should work.
To target the #root element you need to use getContainer function from ant design.
<Modal getContainer="#root" ... />
https://ant.design/components/modal/#API -> search for getContainer

IE11: Add extra space above anchor tags

I read many suggestions how to add an extra space above anchor tags, but none of them is working in IE11.
I need 250 px space above them because my sticky header is ca 250 px high.
I tried two most promising looking methods, one with the target element, ant the second one with the id elements:
/* target-Method: Working in Chrome, but not working in IE 11 */
:target::before {
content:"";
display:inline-block;
height:250px;
margin:-250px 0 0 0;
}
/* id+before - Method: Working in Chrome, but not working in IE 11 */
h2[id], h3[id] {
position: relative;
z-index: 1;
}
h2[id]::before, h3[id]::before {
display: inline-block !important;
content: ' ' !important;
height: 250px !important;
margin-top: -250px !important;
visibility: hidden !important;
pointer-events: none !important;
position: absolute;
z-index: -1;
}
But none of them is working in IE11.
Or are overlapping the link in the element above!
Codepen (here without a sticky header):
https://codepen.io/abc001/pen/oRmmwp
Try to use the following code with your Html elements:
<style>
/* target-Method: Working in Chrome, but not working in IE 11 */
:target::before {
content: "" !important;
display: inline-block !important;
background-color: antiquewhite !important;
height: 250px !important;
width: 100% !important;
margin-top:250px;
}
/* id+before - Method: Working in Chrome, but not working in IE 11 */
h2[id], h3[id] {
position: relative;
z-index: 1;
}
h2[id]::before, h3[id]::before {
content: ' RR this -';
}
/* Spacer */
.spacer {
width: 100%;
height: 500px;
}
.row .col-12{
background-color:aquamarine
}
</style>
The result as below:

Lightboxed images get distorted when double-tapping or pinch-zooming

I'm using Photoswipe Masonry Gallery plugin (WP), but when the images are double-tapped or pinch-zoomed, they get distorted.
Any idea what is causing this? It's not a plugin issue, as it works perfectly when switched to Twenty Fifteen theme. FYI, I'm using <meta name="viewport" content="width=device-width">. Anything suspicious in the below CSS I'm using?
#media screen and (max-width: 700px) {
/* basics */
#content,
#sidebar,
.endbar_left,
.endbar_right {
float: none;
width: 100%;
}
#content {
margin-left: 0%;
padding-left: 0%;
padding-top: 20px;
}
html,
body {
width: auto !important;
overflow-x: hidden !important;
}
img {
border: none;
max-width: 100%;
height: auto;
}
#header {
padding-bottom: 0 !important;
}
/* posts */
.inside2 {
padding: 0 10px 10px 10px;
}
.post {
padding-right: 3px;
}
.pics_article {
float: none;
margin-left: 0;
}
}
Thank you in advance for your help. FYI, I'm not a web developer. Someone with okay html/css knowledge. Thanks!
Just found the solution by myself! It was !important; in my img properties (not in the above-posted #media query, but in the main part of CSS) causing this distortion. Removing !important; from the below has resolved the issue.
img {
border: none;
max-width: 100% !important;
height: auto;}

Responsive Sidebar does not work properly in the smartphone version

I have a problem with sidebar of this page. I can not make it go under in the responsive version, especially in the smartphone version. Sidebar remains attached to the contents of the left but does not wrap
This is the link for the codepen
If codepen does not work, this is the link for the website.
archive-posts-w.with-sidebar .archive-sidebar {
display: block !important;
position: relative;
top: inherit;
left: 0;
width: 100%;
max-width: 350px;
bottom: inherit;
right: inherit;
clear: both;
float: left;
}
Html there will certainly be errors because it is a copy of a source of a website wordpress.
There are a few problems here:
Your container .archive-posts-w.with-sidebar has display: table;. Change that to display: block for smaller screens (i.e. in your media query)
The CSS for the part above your sidebar should be like this (for smaller screens):
.archive-posts-w.with-sidebar .archive-posts {
display: block;
vertical-align: top;
width: 100%;
}
And for .archive-posts-w.with-sidebar .archive-sidebar you have a max-width setting of 350px, also inherited from everal other rules, so change this rule (for smaller screens) to
.archive-posts-w.with-sidebar .archive-sidebar {
display: block !important;
position: relative;
top: inherit;
left: 0;
width: 100%;
max-width: none;/* <-- this one is changed */
bottom: inherit;
right: inherit;
clear: both;
}
First add class table td in that td class="test"
td.test
{
display:block
}
#sb_instagram .sbi_header_text .sbi_bio, #sb_instagram .sbi_header_text h3
{
margin:0px!important;
}
#sb_instagram .sbi_header_text .sbi_bio, #sb_instagram .sbi_header_text h3
In that class you have 'margin: 0 0 0 60px!important;' you change that 0px
abd check the devices
http://www.responsinator.com/?url=http://www.alchimieadv.biz/ricette/&device=ipad&orientation=portrait

Bootstrap max height

The contents of my website are not displayed correctly. I have already tried in my css file, but without success.
Here is an excerpt from my styles.css.
Thanks for the help
* {
padding: 0;
margin: 0;
}
/* Body */
body {
position: relative;
margin: 30px 0 100px;
padding-top: 30px;
min-height: 100%;
height: 100%;
}
.navbar-fixed-top {
margin-top: 30px;
}
Have you tried doing it this way:
html {
height: 100%;
}
body {
min-height: 100%;
}
It should work, if I understood what you are trying to do.
If i iunderstand correct when you scroll down to the bottom of the page the footer is covering part of the content. So what you need to do is either with jquery get the height of footer and apply it as margin-botton to the content... or set max-height to footer and set that max-height value as margin botton to the content

Resources