How to prevent page content from shift when scroll appears? [duplicate] - html

This question already has answers here:
Prevent a centered layout from shifting its position when scrollbar appears
(7 answers)
Closed 5 years ago.
I am currently working on project about car travelling http://wayfi.ru and
I have encountered a problem recently - page content shifts to the left after vertical scroll appears. How to prevent this?
As I know, one could always display disabled scroll and make it enable if there is necessary.
Do you know better technique to accomplish this?

I'm afraid I do not know of any other way to do this apart from always showing the scrollbar, active or not.
The simplest way I think is:
html {
overflow-y: scroll;
}
This way, even on pages without scrolling there is space reserved for the scrollbar and the content won't jump around between pages.

Related

How to force a fixed navbar to have full width of the PAGE rather than the viewport? [duplicate]

This question already has answers here:
Horizontal Scroll Table in Bootstrap/CSS
(3 answers)
Closed 4 years ago.
In my web application, I have a create and edit page for tickets, which include a dynamic input table (in other words, my table populates a row upon clicking a button with a single cell holding a drop down list, and upon selecting the drop down list, it fills the remainder of the row with the necessary input fields). because of this, one row that I have goes beyond the view port. I am trying to find a way to set up my shared layout template to fully extend the width of the header? I have already tried auto and 100% width, but I believe those only apply to the initial view port (I could be wrong). I know it is purely cosmetic, but it looks rather awkward otherwise.
Here is my div tag in my shared layout page:
<div class="navbar navbar-inverse navbar-fixed-top" style="background-color:#0139a6;">
screenshot (too low reputation to directly embed image)
After trying to wrap the navbar div in a container-fluid class div
I realized that my question is essentially a duplicate of the question linked below. This is because there is no way to style my navbar without hard coding the pixel value, which is obviously not best practice, so instead, applying a scrollbar to my very wide table should do the trick, instead.
Horizontal scroll table in bootstrap css

Make element appear on top, but underneath clickable [duplicate]

This question already has answers here:
Click through div to underlying elements
(17 answers)
Closed 6 years ago.
I'm trying to make a notification system where a small box appears in the top right corner of the screen.
However, I want the part of the screen that is under the notification to be clickable. As it is now, when the notification is there, you can't interact with what's under it. How can I make the area under it clickable? I've tried messing around with the z-index, position, and transform properties, but they still make the notification appear on top of the other content.
Use pointer-events: none on the popup box to allow clicks and cursor interactions to pass through it.
Note that this is not supported by IE10 or under, but that makes up a very small percentage of users.
http://caniuse.com/pointer-events/embed/

An alternative to hidden so that the site doesnt act like its still there? [duplicate]

This question already has answers here:
How to hide elements without having them take space on the page?
(17 answers)
What is the difference between visibility:hidden and display:none?
(21 answers)
Closed 7 years ago.
Okay so I am trying to build a header that I like. I have been using bootstraps header and using my own CSS file to alter parts.
I have increased the size of the header, the colour etc. I have an icon on the left, nav buttons in the middle and social icons on the right. The social icons on the right keep getting in the way when the site is resized so I used the hidden tag to remove them at a certain media size, but even though you can't see them you the site still acts like they are there. Is there a way to solve this?
Here's the thing.
display: none removes the element from the document flow.
visibility: hidden does not remove the element from the document flow.
So, whenever you're trying to hide an element without some weird document flow happening, use display: none;
Try using display:none instead of visibility:hidden.
Instead of visibility:hidden use display:none in the css. On display:none, the site will not act like the tag is there.

Ideas on improving scrolling performance on my site [duplicate]

This question already has an answer here:
Fixing scrolling performance with fixed background image on div
(1 answer)
Closed 7 years ago.
I have a number of div elements with fixed position backgrounds which are killing performance on my page. An ideas on how I can improve this?
http://petermankiewich.com/
The problem is known as 'reflows' and 'repaints'. Each pixel you scroll down, fixed position elements are repainted and is ouch on performance.
You should look into adding backface-visibility: hidden; to your fixed position elements.
source.
Also, look into CSS's will-change: transform property, but read about it first as misuse can cost even more in performance.
source
Anoter great article here about speeding things up.

Website that has fixed length but more underneath [duplicate]

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
Make a <DIV> occupy all VISIBLE height screen, with content below it
This probably has a strange title as I was not sure how to call this, however I am wanting to make a website similar to fiftythree.com where you see the homepage but then if you scroll down the navigation buttons appear. No matter the screen resolution if you open the website it will always be hidden until you scroll down. What is this called and how could I go about replicating it, thanks!
Have you tried making a div for your navigation and a div for your main content.
This website does not have a fixed navigation bar.
You might want to consider using a fixed position in your css if you want the navigation bar to be fixed. Also you might want a minimum width for your body tag (also css). This avoids your navigation elements stacking up on a small window.