How to remove borders from loading gif on a dark background?

久未见 提交于 2019-12-11 06:17:49

问题


I'm trying to create a dialog with a loading gif without any borders or background for my web application. I'm using PrimeFaces for JSF. I can't delete the shadow on the border. Here image and code:

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:p="http://primefaces.org/ui">
    <style>
        .loadingPanel .ui-widget-content{
            background: transparent !important;
            border:none !important; 
            box-shadow:none !important; 
        }
    </style>

    <p:dialog widgetVar="loadingDialog" draggable="false" modal="true" closable="false" resizable="false" showHeader="false" styleClass="loadingPanel">
        <p:graphicImage name="images/loading_spinner.gif" library="ecuador-layout" />
    </p:dialog>

</html>

回答1:


The problem is with the GIF format. It doesn't support alpha channel transparency, so the edges of transparent images can look very bad (depending on the background it's displayed on).

Instead of a GIF animation you could use a SVG animation or use an animated icon, for example using PrimeIcons:

<i class="pi pi-spin pi-spinner" style="font-size: 3em"></i>

See also:

  • How to get better transparency with GIFs?
  • https://www.google.com/search?q=svg+loader+animation


来源:https://stackoverflow.com/questions/56505619/how-to-remove-borders-from-loading-gif-on-a-dark-background

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!