Is there a way to apply the following CSS to a specific div
only in Google Chrome?
position:relative; top:-2px;
When working with HTML and CSS, it is common to face browser-specific issues for the same web application. Therefore, it becomes necessary to develop browser-specific CSS code to assure a seamless user experience, regardless of the browser they use. CSS Grid: CSS Grid is widely used in web design.
Go to element panel ( Ctrl + Shift + p and type show element panel). Scroll to the head element right click on the element and choose Edit as HTML, go to the bottom of that element ( Ctrl + End ), add your <style></style> element there add your style in that element, and hit Ctrl + Enter .
CSS Solution
from https://jeffclayton.wordpress.com/2015/08/10/1279/
/* Chrome, Safari, AND NOW ALSO the Edge Browser and Firefox */ @media screen and (-webkit-min-device-pixel-ratio:0) { div{top:10;} } /* Chrome 29+ */ @media screen and (-webkit-min-device-pixel-ratio:0) and (min-resolution:.001dpcm) { div{top:0;} } /* Chrome 22-28 */ @media screen and(-webkit-min-device-pixel-ratio:0) { .selector {-chrome-:only(; property:value; );} }
JavaScript Solution
if (navigator.appVersion.indexOf("Chrome/") != -1) { // modify button }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With