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.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
According to the inspect elements menu, this thing called <tbody> exists, and <tr> is inside it. The problem is, tbody, is 100% height and width, which it should be, but <tr> is always 4 pixels less in height than it should be, even when styled at 100% height
THEN
inside there are two tds, one has 20% and one has 80% width, but they both have these annoying border type things, that i cant get rid of, it looks like margin but honestly cannot find anything
This question is a bit of a mess, but i cant find any sort of solution
I would suggest looking at the padding around "tr". A great tool to use is Pesticide (it's a Google Chrome extension) that when it turns on, it will show the outlines of different sections to help you determine what is being controlled in terms of padding/margin. It sounds like there may be a padding issue. If you turn on Chrome Developer, under the Element tab on the right side, if you scroll all the way down, you can see the box model and see the padding/margin that is used in the respective section.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I was wondering when styling some of my website's what the correct use of the top, right, left, bottom properties are.
This would sound like an way too open question so I am narrowing it down to this: Let's say if I am styling some text that I want at the bottom of my page would it be correct to use something like bottom: 265px;?
This would give the desired result however is this also considered clean code and a correct use of this function?
Or would there be a better option for this. I am wondering this because I also have to make my site's responsive as well.
I have had a read through W3schools - CSS Positioning and Stackoverflow Question - CSS Positioning but it did not have the anwser I am looking for
You use top, bottom, left, and right to place absolute-positioned content.
There are certainly cases where absolute positioning is the best and cleanest approach. The problem is that it's too easy to overuse, which can lead to very fragile layouts.
Signs that you're overusing absolute-positioning:
every time you change something in the page you end up having to
update a lot of absolute-positioned elements
different content (a too-long header, or a too-short paragraph, or etc) causes things to overlap unintentionally
your layout only works for specific screen sizes, and doesn't flow to match the browser window width
It's almost always better to start by letting the browser do most of the work, depend on document flow to position the majority of the content, and reserve absolute positioning for only the elements that really truly need to be in exactly the same place no matter what else is going on on the page. In practice, most of the time, this tends to be relatively few (or no) elements.
This question already has answers here:
CSS Sprites and repeating backgrounds
(2 answers)
Closed 7 years ago.
Using css sprites for icon-style images is best practice by now and pretty easy.
Using multiple repeating backgrounds in one image is traditionally only possible if they either use only vertical or horizontal repeat.
Or is it? Meanwhile with css3 and html5 and all stuff, is there a way to combine multiple background images in one css sprite to make an background pattern and use vertical and horizontal repetition?
Edit/Note: I know this is not the first time such a question is asked. But most/all answers I found are some time ago. I'm just wondering if there is a solution today.
Edit: To illustrate what I'm looking for: http://ibin.co/21LqyJvnGdMB
Yes you can use css sprites for repeating background.
The rule is pretty simple: if you want the background to repeat
vertically (top to bottom), place the images in the sprite
horizontally (left to right) and make sure the individual images in
the sprite have the same height. For the opposite case: when you want
to repeat horizontally, sprite vertically.
check this article for better understanding. http://www.phpied.com/background-repeat-and-css-sprites/
This question already has answers here:
How to make a fixed div?
(10 answers)
Closed 9 years ago.
What is the best way maintain the position of a DIV exactly at the bottom of the browser window?
An example is the gray social media box exactly at the bottom of browser in the following link:
http://www.zdnet.com/android-vs-windows-now-the-battle-for-the-desktop-really-begins-7000025027/
It works well after browser window re-size.
Thank you,
Update:
I personally don't think CSS positioning is the the best solution since there are many issues with IE 6 or 7.
I think the best option should be JavaScript or JQuery.
I don't think the example I provided uses CSS. I think I uses JavaScript.
I hope someone can shed some light here.
If you use inspect elements on that object you can see the code that is currently working
display: block;
position: fixed;
bottom: 0px;
z-index: 4;
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.