There are times when you're customizing your network that your CSS codes act differently in different browsers. These snippets of code will help you fix those types of problems.
Targets Chrome & Safari
@media screen and (-webkit-min-device-pixel-ratio:0) {
/* your CSS here */
}
Targets firefox
@-moz-document url-prefix() {
/* your CSS here */
}
Targets IE 10 & 11
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
/* your CSS here */
}
Targets IE 7, 8 & 9 - CSS stylesheet
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="https://api.ning.com//ie789.css" />
<![endif]-->
Example
I wrote a neat little code to enhance the comment threads it looks perfect in IE9, 10, 11, Chrome & Safari with a left margin of 60px but in Firefox it pushes it 60 pixels too far left. So we'll use the Firefox query to fix this issue.
The original code no fix
.comments-list.comments-level1 .comments-comment{
border-bottom: 1px solid #aaa;
margin-left:0px;
left:0px;
padding-left:0px!important;
padding-top:5px; }
.comments-comment .comments-list .comments-comment DIV.comments-commentBody.media-frame{
border: 1px solid #aaa;
margin-bottom:5px;
padding-top:10px!important;
padding:5px;}
.comments-comment .comments-list .comments-comment DIV.comments-commentBody.media-frame:before{
background:url("https://storage.ning.com/topology/rest/1.0/file/get/963872767?profile=original")
no-repeat!important;
background-position:left 0px top -0px!important;
background-size: 20px 20px!important;
content: ""!important;
width:100%;
color: transparent!important;
margin-top:-25px!important;
margin-left:60px!important;
position:absolute!important;
z-index:2!important;
padding:10px;}
And the Firefox css fix.
@-moz-document url-prefix() {
.comments-comment .comments-list .comments-comment DIV.comments-commentBody.media-frame:before {
margin-left:0px!important;}
}
The completed code that looks the same in all browsers.
.comments-list.comments-level1 .comments-comment{
border-bottom: 1px solid #aaa;
margin-left:0px;
left:0px;
padding-left:0px!important;
padding-top:5px; }
.comments-comment .comments-list .comments-comment DIV.comments-commentBody.media-frame{
border: 1px solid #aaa;
margin-bottom:5px;
padding-top:10px!important;
padding:5px;}
.comments-comment .comments-list .comments-comment DIV.comments-commentBody.media-frame:before{
background:url("https://storage.ning.com/topology/rest/1.0/file/get/963872767?profile=original")
no-repeat!important;
background-position:left 0px top -0px!important;
background-size: 20px 20px!important;
content: ""!important;
width:100%;
color: transparent!important;
margin-top:-25px!important;
margin-left:60px!important;
position:absolute!important;
z-index:2!important;
padding:10px;}
@-moz-document url-prefix() {
.comments-comment .comments-list .comments-comment DIV.comments-commentBody.media-frame:before{
margin-left:0px!important;} }
Replies
This is a helpful bit of information. Thanks for sharing it, George!
You're welcome and thank you TJ.
I like the smiley faces you're using in your comments.
Nice work George
Thank you Dave.. Give me a call please.. :)
will ring tomorrow :)
Looks great, George. Give me a ring when your not busy, please.
Blessings.
Ok Jim talk soon. Blessings :)