7

I wanted my logo to be in SVG format so that I didn't have to worry about resolution and it ever being blurred.

I just put the website onto the server, open it on my iPhone, and this is what I see: https://i.stack.imgur.com/pAJST.jpg

Messed around with the CSS doing everything I could think of (I'm new to Web).

What is going on? It looks great on Chrome, however I also just checked desktop Safari and it looks blurry there too.

Here's my two files:

index.html:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.3.1/dist/semantic.min.css">
    <link rel="stylesheet" type="text/css" href="custom.css"/>
    <script defer src="https://cdn.jsdelivr.net/npm/semantic-ui@2.3.1/dist/semantic.min.js"></script>
</head>
<body>

    <div class="ui borderless main menu fixed">
        <div class="ui text container" style="max-width: 100% !important">
            <div class="header item">
                <img id="headerLogo" class="logo" src="images/FullLogo_test.svg">
            </div>

            <a href="tel:555-555-5555" class="ui right floated item" tabindex="0">
                <button class="ui inverted black button">Call (555) 555-5555</button>
            </a>
        </div>
    </div>
</body>
</html>

custom.css:

#headerLogo {
    width: 200px;
}

@media only screen
and (min-device-width : 380px)
and (max-device-width : 480px) {

    #headerLogo {
        width: 150px;
    }
}

@media only screen
and (min-device-width : 320px)
and (max-device-width : 380px) {

    #headerLogo {
        width: 120px;
    }
}
Jack Douglain
  • 79
  • 1
  • 1
  • 2
  • Can you link the SVG file? Or at least the opening `` tag and its attributes? Make sure its `width` and `height` attributes (ie. in the file) are either missing, or set to `"100%"`. – Paul LeBeau Jun 06 '18 at 05:47
  • @PaulLeBeau https://pastebin.com/MSiD945Y I've also tried removing the viewBox and setting it to "0 0 0 0" – Jack Douglain Jun 06 '18 at 10:04
  • 1
    The SVG looks okay. Safari seems to have a lot of problems with blurry SVGs. It is a common question here. But usually it due to the use of CSS scaling. Did it have a `width` and `height` originally? If not , can you try an experiment? Try adding `width="503" height="118"` to the top-level `` element. See if that makes a difference. – Paul LeBeau Jun 06 '18 at 13:28
  • Yeah, that's where the width and height elements were originally, except they were width="503px" height="118px", just tried adding the elements without the "px" and had no luck. I ended up just adding a big png of my logo that's 1000px wide, every browser mobile and desktop seems to be able to scale it beautifully. Would still be nice to solve this Safari issue for the people! – Jack Douglain Jun 07 '18 at 00:26
  • It seems a similar problem https://stackoverflow.com/a/63189810/2214284 below you can see solution – Aleksandr Zidyganov Jul 31 '20 at 10:10

2 Answers2

0

Unable to reproduce this problem. But as it is five years down the track, presumably the rendering bug you were experiencing has now been fixed.

.headerLogo {
    width: 200px;
}
<svg class="headerLogo" viewBox="0 0 503 118" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <!-- Generator: Sketch 50.2 (55047) - http://www.bohemiancoding.com/sketch -->
    <title>FullLogo</title>
    <desc>Created with Sketch.</desc>
    <defs>
        <filter x="-1.4%" y="-3.9%" width="102.8%" height="110.9%" filterUnits="objectBoundingBox" id="filter-1">
            <feOffset dx="0" dy="2" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
            <feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1"></feGaussianBlur>
            <feColorMatrix values="0 0 0 0 0   0 0 0 0 0   0 0 0 0 0  0 0 0 0.5 0" type="matrix" in="shadowBlurOuter1" result="shadowMatrixOuter1"></feColorMatrix>
            <feMerge>
                <feMergeNode in="shadowMatrixOuter1"></feMergeNode>
                <feMergeNode in="SourceGraphic"></feMergeNode>
            </feMerge>
        </filter>
    </defs>
    <g id="Logo" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
        <g id="FullLogo" filter="url(#filter-1)" transform="translate(2.000000, 2.000000)">
            <g id="Group">
                <text id="CONTRACTING" font-family="Avenir-Light, Avenir" font-size="55.987199" font-weight="300" letter-spacing="9.55000019" fill="#000000">
                    <tspan x="0" y="108.831806">CONTRACTIN</tspan>
                    <tspan x="458.521" y="108.831806">G</tspan>
                </text>
                <g id="V4" transform="translate(2.000000, 0.000000)">
                    <g id="T" transform="translate(441.552376, 0.000000)">
                        <rect id="Rectangle" stroke="#A50D1F" stroke-width="5.5987199" x="2.79935995" y="2.79935995" width="47.4024951" height="47.4024951"></rect>
                        <text id="S" font-family="Avenir-Black, Avenir" font-size="37.3247993" font-weight="700" letter-spacing="-0.146883539" fill="#000000">
                            <tspan x="16" y="38">S</tspan>
                        </text>
                    </g>
                    <g id="E" transform="translate(379.219961, 0.000000)">
                        <rect id="Rectangle" stroke="#A50D1F" stroke-width="5.5987199" x="2.79935995" y="2.79935995" width="47.4024951" height="47.4024951"></rect>
                        <text font-family="Avenir-Black, Avenir" font-size="37.3247993" font-weight="700" letter-spacing="-0.146883539" fill="#000000">
                            <tspan x="14.9299197" y="38.119744">E</tspan>
                        </text>
                    </g>
                    <g id="B" transform="translate(314.274810, 0.000000)">
                        <rect id="Rectangle" stroke="#A50D1F" stroke-width="5.5987199" x="2.79935995" y="2.79935995" width="47.4024951" height="47.4024951"></rect>
                        <text id="N" font-family="Avenir-Black, Avenir" font-size="37.3247993" font-weight="700" letter-spacing="-0.146883539" fill="#000000">
                            <tspan x="11" y="38">N</tspan>
                        </text>
                    </g>
                    <g id="A" transform="translate(251.942395, 0.000000)">
                        <rect id="Rectangle" stroke="#A50D1F" stroke-width="5.5987199" x="2.79935995" y="2.79935995" width="47.4024951" height="47.4024951"></rect>
                        <text id="O" font-family="Avenir-Black, Avenir" font-size="37.3247993" font-weight="700" letter-spacing="-0.146883539" fill="#000000">
                            <tspan x="11" y="38">O</tspan>
                        </text>
                    </g>
                    <g id="H" transform="translate(186.997245, 0.000000)">
                        <rect id="Rectangle" stroke="#A50D1F" stroke-width="5.5987199" x="2.79935995" y="2.79935995" width="47.4024951" height="47.4024951"></rect>
                        <text id="B" font-family="Avenir-Black, Avenir" font-size="37.3247993" font-weight="700" letter-spacing="-0.146883539" fill="#000000">
                            <tspan x="15" y="38">B</tspan>
                        </text>
                    </g>
                    <g id="P" transform="translate(124.664830, 0.000000)">
                        <rect id="Rectangle" stroke="#A50D1F" stroke-width="5.5987199" x="2.79935995" y="2.79935995" width="47.4024951" height="47.4024951"></rect>
                        <text id="G" font-family="Avenir-Black, Avenir" font-size="37.3247993" font-weight="700" letter-spacing="-0.146883539" fill="#000000">
                            <tspan x="12" y="38">G</tspan>
                        </text>
                    </g>
                    <g id="L" transform="translate(62.332415, 0.000000)">
                        <rect id="Rectangle" stroke="#A50D1F" stroke-width="5.5987199" x="2.79935995" y="2.79935995" width="47.4024951" height="47.4024951"></rect>
                        <text id="O" font-family="Avenir-Black, Avenir" font-size="37.3247993" font-weight="700" letter-spacing="-0.146883539" fill="#000000">
                            <tspan x="11" y="38">O</tspan>
                        </text>
                    </g>
                    <g id="A">
                        <rect id="Rectangle" stroke="#A50D1F" stroke-width="5.5987199" x="2.79935995" y="2.79935995" width="47.4024951" height="47.4024951"></rect>
                        <text id="D" font-family="Avenir-Black, Avenir" font-size="37.3247993" font-weight="700" letter-spacing="-0.146883539" fill="#000000">
                            <tspan x="12" y="38">D</tspan>
                        </text>
                    </g>
                </g>
            </g>
        </g>
    </g>
</svg>
Brett Donald
  • 6,745
  • 4
  • 23
  • 51
0

If any of the elements in your SVG have a drop shadow effect, Safari may render them blurry. SVGs without drop shadows should appear fine. To ensure optimal rendering, consider removing the drop shadow effects and creating a separate layer with a blur effect if a shadow is necessary.