Firefox CSS is messed up how can i fix it? - css

In Chrome it's working good and all the CSS is inline - in the same line
but in Firefox it's messed up for some reason.
This is how it looks in Firefox:
I'm new to Firefox CSS, I have tried to play around with the CSS and search how to use CSS in Firefox but i did't succeed to fix it.
Is some one know how to fix it in Firefox ?
My html:
<template>
<div class="object-document">
<div class="document-icon">
<i
v-if="document.fileType == fileType.Document"
class="el-icon-fa-file-o"
></i>
<i
v-if="document.fileType == fileType.Image"
class="el-icon-fa-file-image-o"
></i>
<i
v-if="document.fileType == fileType.Video"
class="el-icon-fa-file-video-o"
></i>
</div>
<div
class="document-name"
:title="document.dateModified + ' ' + document.name"
>
<span>{{ document.name }}</span>
</div>
<div class="document-btns">
<el-button-group>
<a class="el-button" :href="getDownloadDocUrl(document, true)">
<i class="el-icon-fa-download"></i>
</a>
<a
class="el-button"
target="_blank"
:href="getDownloadDocUrl(document)"
>
<i class="el-icon-fa-eye"></i>
</a>
<a class="el-button" v-if="visibleForUser(userRoleId)">
<i class="el-icon-delete"
#click="showDeleteDialog(document)"></i>
</a>
</el-button-group>
</div>
</div>
</template>
css:
.object-document {
display: flex;
position: relative;
line-height: 23px;
& > .document-icon {
padding-right: 5px;
}
& > .document-name {
flex: 1 !important;
overflow: hidden !important;
text-overflow: ellipsis !important;
width: 50px;
white-space: nowrap !important;
}
& > .document-btns {
& > .el-button-group {
& > a {
padding: 2px 3px !important;
}
}
}
}

In general, there are some attributes that don't work in Firefox, but work in other browsers. In the link below you will find all information you need. Check if you have some attributes in your code which are mentioned in the link. If so, adjust them.
For many attributes you have to use -moz prefix so they work in Firefox. The goal is to define both, the normal CSS rule and the same CSS rule for Firefox. The browsers will decide by themselves, which rule to take.
Alternatively you can check you CSS with devtools in Firefox and find out, which CSS rules are not applied. Then look, what the rules have to look like for Firefox and extend them, as described.
Link with all information: https://developer.mozilla.org/en-US/docs/Web/CSS/Mozilla_Extensions

Related

Hiding span under div in CSS

Below is the code for my WP post. I'm trying to hide the span for comment. So that it doesn't appear on the blog post.
<div class="blog-stats">
<span class="clock">
<i class="fa fa-calendar stats-item"></i>
<span class="text-center text-light stats-item">February 15, 2020</span>
</span>
<span class="comment">
<i class="fa fa-comment stats-item"></i>
<span class="text-center text-light stats-item">no comments</span>
</span>
<span class="user">
<i class="fa fa-user stats-item"></i>
<span class="text-content text-light stats-item">Wayne John</span>
</span>
</div>
I tried a few below and it didn't work.
.blog-stats.comment {
display: none;
}
span .comment {
display: none;
}
span.comment {
display: none;
}
Any idea how to fix it?
Add below CSS and try :
<style type="text/css">
.blog-stats .comment span{
display: none !important;
}
</style>
your CSS code is OKAY!
try putting "!important" besides your style and clear your browser cache. maybe fixed.
please put space between classes like
.blog-stats .comment {
display: none;
}
or
.blog-stats .comment {
display: none !important;
}
this will work please try
In case if you don't want to use !important try the below version.
.blog-stats .comment.comment {
display: none;
}
Note: You can increase the .comment class x number of times to get higher precedence.
Example:
.blog-stats .comment.comment.comment {
display: none;
}
Please put this code in your css
.blog-stats span.comment{display: none;}

How to override Angular material styles with global styles.css while avoiding !important?

In my angular 7 application, I am using material design. In my global styles.css file, I have some styling for material components, namely for mat icons. However, my settings are overridden by material's own style.
Using !important obviously works, but I think there is a more natural way, I just can't figure it out. In chrome dev tools, my CSS class selector simply appears below that of material design selector, and I think this means that it was simply applied sooner, and thus material style takes precedence, since they are both class selectors and should have the same priority (that is my understanding, anyway).
Relevant entry from styles.css:
.icon {
display: inline-block;
height: 30px;
width: 30px;
margin: 0 auto;
text-align: center;
vertical-align: middle;
}
How it appears in chrome dev tools:
.mat-icon {
background-repeat: no-repeat;
display: inline-block;
fill: currentColor;
height: 24px;
width: 24px;
}
.icon {
height: 30px;
width: 30px;
margin: 0 auto;
text-align: center;
vertical-align: middle;
}
Width and height are simply crossed out in my .icon style.
How can I make my style sheet be prioritized? Can I somehow specify the order in which stylesheets load, or explicitly tell angular that I want my styles take over material styles?
EDIT: added HTML where mat icons are:
<mat-toolbar color="primary">
<div fxFlex fxLayout>
<mat-toolbar-row fxFlex fxLayout fxLayoutGap="20px" class="navigation-items icon-group">
<span>
<a routerLink="/">
<mat-icon class="icon">home</mat-icon>
<span class="label">Home</span>
</a>
</span>
<span>
<a routerLink="/product">
<mat-icon class="icon">bubble_chart</mat-icon>
<span class="label">Product</span>
</a>
</span>
<span>
<a routerLink>
<mat-icon class="icon">widgets</mat-icon>
<span class="label">Expedition</span>
</a>
</span>
<span class="spacer"></span>
<span>
<a routerLink (click)="logout()">
<mat-icon class="icon">input</mat-icon>
<span class="label">LogOut</span>
</a>
</span>
</mat-toolbar-row>
</div>
</mat-toolbar>
It is a specificity problem. You can modify the mat-icon class directly, use id which has higher specificity or use combined selector like
.icon-group > .icon

CSS on hover effect not working

Why does the css :hover effect not work?
http://jsfiddle.net/t7on1k15/
body,html
{
font-family: courier;
height:100%;
min-width: 100%;
margin:0;
padding: 0;
}
#idDivBodyWrapper
{
margin:0;
padding:0;
height: 100%;
width: 100%;
background: lightgray;
}
#four:hover
{
color:black;
}
The HTML
<div id="idDivBodyWrapper" style="vertical-align:middle;">
<div style="position:absolute;display:block;float:left;left:0;Top:0"><button class="btn btn-default btn-lg" style="opacity:1;background:transparent;font-family:courier;font-weight:bold;" onclick="location.href='http://vqplan.com';"><i style="color:white;opacity:1;" class="fa fa-th fa-fw fa-5x"></i><br><span style="opacity:1;color:white">home</span></button></div>
<table style="width:100%;height:100%;background:black;clear:both;vertical-align:middle;text-align:center;"><tr><td>
<h1 id="four" style="font-size:10vh;color:white;">Code that lasts.<br><br><i id="one" class="fa fa-terminal fa-3x fa-fw" style="color:white;"></i></h1>
</td></tr></table>
</div><!--end idDivBodyWrapper-->
Here is one that does work:
http://jsfiddle.net/tuxdukz4/
CSS - CASCADING style sheets. You've got style="color:white" inside your h1#four element. That color:white is at a higher precedence level than your external style sheet rule, so color: white overrides the :hover style.
If you mod your fiddle and put color:purple into the h1's style= attribute, you'll get the exact same behavior: the hover won't work.
Because of CSS Specificity. I truly recommend you to read about it: http://www.smashingmagazine.com/2007/07/27/css-specificity-things-you-should-know/
You have an element-level style color: white that overrides the hover effect.
Check this for a working one: http://jsfiddle.net/t7on1k15/1/
fiddle: http://jsfiddle.net/t7on1k15/2/
change the <h1 id="four" style="font-size:10vh;color:white;"> html to this:
<h1 id="four">Code that lasts.<br><br></h1>
and then add this css:
#four {
font-size:10vh;color:white;
}
your inline style has highest precedence over other css code.
I believe that putting the style inline ("style="font-size:10vh;color:white;") takes precedence over css. Inline style has higher priority. You actually couldn't style #four without hover in css if you use an inline style.

div width auto !important seems not to work in ie6/ie7

THE HTML
<div class="grid_11 omega" id="homeGalleryFichaGold">
<div class="contSlideGalleryUp" style="display: none;">
HOTEL GALLERY
</div>
<div style="display: block;" class="contSlideGalleryDown">
HOTEL GALLERY
</div>
<div style="display: block;" id="panelGallery">
<ul>
<li class="selected"><a class="photos" href="#" title=""><span>PHOTOS</span></a></li>
<li><a class="videos" href="#" title=""><span>VIDEOS</span></a></li>
<li><a class="suites" href="#" title=""><span>SUITES 3D</span></a></li>
<li><a class="location" href="#" title=""><span>LOCATION</span></a></li>
<li><a class="publication" href="#" title=""><span>PUBLICATION</span></a></li>
<li><a class="tour" href="#" title=""><span>INTERACTIVE TOUR</span></a></li>
<li><a class="panorama" href="#" title=""><span>PANORAMA</span></a></li>
<li><a class="googlearth" href="#" title=""><span>GOOGLE EARTH</span></a></li>
</ul>
</div>
</div>
Basically i can't get #panelGallery to have an 'auto' width in IE6/7 (works fine in all other)
CSS
#panelGallery {
background-color: #333;
color: #FFFFFF;
float: right;
font-size: 11px;
font-weight: bold;
height: 65px;
line-height: 65px;
opacity: 0.9;
/*width: 640px;*/
position:absolute;
bottom: 0px;
right:0px;
}
.contSlideGalleryDown {
position:absolute;
bottom: 65px;
right:0;
}
And i add this hack for ie6/7
#panelGallery {
*width: auto !important;
}
But still uses all width
It looks like IE uses Quirks Mode, because I'm sure that IE6/IE7 have support for width:auto. You can insert bookmarklet below to detect rendering mode.
javascript:alert(document.compatMode)
CSS1Compat means Standards Mode and BackCompat Quirks Mode.
If it shows BackCompat that means that IE seen something before <!DOCTYPE>. IE 6 and 7 uses Quirks Mode if it sees nearly anything before DOCTYPE, BOM mark or HTML comment counts into it.
There is already some question about it, so I will just link to it: Why is the site running in IE quirks mode?
By the way, http://validator.nu/ can detect if site would trigger Quirks Mode in IE by using either comments or BOM mark.
Also, some DOCTYPEs can trigger Quirks Mode even if there is nothing before them can trigger Quirks Mode. http://hsivonen.iki.fi/doctype/ contains list of those special DOCTYPEs.
Have you tried to use the conditional statement rather than a star hack?
Something like:
<!--[if lte IE 7]>
<style>
#panelGallery {
width: auto !important;
}
</style>
<![endif]-->

<span> indent wrapped text

So I'm simulating a table layout with a div and a couple spans inside it. I'd like the span on the right to indent any text that wraps. I've tried a few things and can't get it to work. Any help would be appreciated.
jsFiddle: http://jsfiddle.net/2Wbuv/
HTML
<div class="display-element">
<span class="display-label">Field 1</span>
<span class="display-field">This is my string of data, some times it is pretty long. Sometimes it is not. This one is.</span>
</div>
<div class="display-element">
<span class="display-label">Field 2</span>
<span class="display-field">This is another string of data.</span>
</div>
CSS
.display-element {}
.display-label {display: inline-block;
width: 100px;
padding-left: 5px;}
.display-field {display: inline;}
Check this out: http://jsfiddle.net/2Wbuv/2/
.display-element {
}
.display-label {
display: inline-block;
width: 100px;
padding-left: 5px;
}
.display-field {
display: inline-block;
padding-left: 50px;
text-indent: -50px;
vertical-align: top;
width: 200px; /* for testing purposes only */
}
<div class="display-element">
<span class="display-label">Field 1</span>
<span class="display-field">This is my string of data, some times it is pretty long. Sometimes it is not. This one is.</span>
</div>
<div class="display-element">
<span class="display-label">Field 2</span>
<span class="display-field">This is another string of data.</span>
</div>
It sounds like you want a hanging indent. CSS something like this should do the trick:
.hanging-indent
{
text-indent : -3em ;
margin-left : 3em ;
}
But since your <span> is an inline element, the text-indent property, as well as other CSS properties pertaining to a block, is meaningless.
The CSS 3 draft specifies a hanging indent. If supported by Browsers, the following should work:
.hanging-indent
{
text-indent: 3em hanging each-line;
}
Unfortunately neither hanging nor each-line values are currently supported in modern browsers as the specification for CSS Text Module Level 3 is still a Draft.
The feature is implemented with a browser specific prefix for WebKit and Chromium. For Firefox there is an open Bug you may vote on.

Resources