What is causing the SVG element to malfunction on iOS devices?

I am facing an issue with the <h1> tag in my design. The SVG element within it is not appearing on mobile phones when I write a media query for devices with a minimum width of 400px, even though it works fine on screens with a minimum width of 800px.

HTML

<div class="explanation">
                  <h1>
                     <div class="goo" contenteditable="true"gt;Elected as a <i>Senior Project Lead</i> at the Biggest Club involved in Technology and Coding: <span id = 'newline'>Coffee</span> 'N' Code.</div>
                  </h1>
                  <!-- Filter: https://css-tricks.com/gooey-effect/ -->
                  <svg style="visibility: hidden; position: absolute;" width="0" height="0" xmlns="http://www.w3.org/2000/svg" version="1.1">
                     <defs>
                        <filter id="goo">
                           <feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur" />
                           <feColorMatrix in="blur" mode="matrix" values="1 0 0 0 0  0 1 0 0 0  0 0 1 0 0  0 0 0 19 -9" result="goo" />
                           <feComposite in="SourceGraphic" in2="goo" operator="atop"/>
                        </filter>
                     </defs>
                  </svg>
               </div>

CSS

.goo {
  font-size: 3rem;
  line-height: 1.35;
  display: inline;
  box-decoration-break: clone;
  background: var(--color-highlight);
  padding: 0.5rem 1rem;
  filter: url('#goo');
  color: black;
}

.goo:focus {
  outline: 0;
}


On larger screens:

https://i.sstatic.net/2jr1N.png

On iOS device:

https://i.sstatic.net/uA9Kr.jpg

Despite the different layout, why do the edges appear unrounded? Also, where is the break in the SVG element like shown in the first picture? Am I missing something here?

Answer №1

If you want to achieve this effect using only HTML and CSS, a good practice is to utilize SVG for images, text animations, and GIFs.

Take a look at the following code snippet:

HTML Code

<div class="explanation">
<p class="description">
<span>Appointed as Lead of Senior Projects</span>
</p>
<p class="description">
<span>at the Largest Club</span>
</p>
<p class="description">
<span>engaged in Technology and Coding: Coffee 'N' Code.</span>
</p>
</div>

CSS Code

.explanation {
  padding:1rem;
  background:#000;
}

.explanation .description {
  position:relative;
  display:block;
  margin:0;
}

.explanation .description span {
  display:inline-block;
  background:#fff;
  padding: 0.5rem 1rem;
  font-size:2rem;
  line-height: 1.35;
  border-radius:5px;
  margin-bottom:5px;
}

@media only screen and (max-width: 600px) {
  .explanation .description span {
     font-size:1.2rem;
   }
}

To make adjustments in responsive mode, use media queries like so:

@media only screen and (max-width: 600px) {
}

You can experiment with different pixel values or play around with the media queries to customize the styling according to your needs.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the most effective way to transfer a value from the server to a React user interface and incorporate it into the styling of the user interface?

Currently, I am utilizing Python as the backend for my React frontend. The backend is passing in values such as 17 or 87, and I aim to use these values as a percentage on the scale that I am constructing. Currently, the scale starts in the center: https:/ ...

Exploring CSS shaders in a browser?

Which browser out there fully supports CSS shaders? ...

Make the text within the CSS style of ".well" wrap around the width

I am looking to style the width of a .well class to be in proportion with the text inside a simple textbox that it contains. What is the best approach to achieve this sizing using CSS? ...

The lengthy email exceeds its limits

Take a look at this code snippet: <div className='mt-[3vh] flex h-1/3 min-h-fit w-[80%] min-w-[300px] flex-col content-center items-center justify-center rounded-2xl bg-white shadow-[0_0_8px_rgba(0,0,0,0.2)]'> {user?.image && ...

Guide on how to display matching options in an input box using HTML datalist based on user input at the beginning

I am a beginner in React and I am looking to create an autocomplete suggestion box for a text input field. I want the suggestions to only match the first letters of the available options, unlike the current behavior of HTML's <datalist>. Althou ...

Tips for creating a clickable title that directs to a URL

I am currently using the "Import All" WordPress plugin to bring in an Excel file containing numerous hyperlinks that point to specific Custom Post Types and a designated field. These hyperlinks are separated by commas from the corresponding title. For exam ...

What is the best way to organize tableview cells into alphabetical sections with a customized header cell?

In my CartVC, I have data being passed from another ViewController through a closure to populate the cells successfully. Now, I am attempting to organize these cells into sections based on their brand in the CartVC. However, all the data seems to be gettin ...

Tips for customizing the appearance of an HTML5 progress bar using JQuery

Here is my method for obtaining the bar: let bar = $('#progressbar'); Styling and animating it is no problem, using either of these methods: bar.css(...) bar.animate(...) However, I am wondering how to adjust the CSS specifically for the prog ...

Tips for customizing the appearance of a jQuery sortable target list prior to dropping items

When using jquery sortable, I am able to customize a placeholder inside a connected list specified in the connectWith option to visualize where the content will be dropped. However, I am struggling to find a way to style the actual list that contains the p ...

Creating CSS style rules for aligning table column headers in JavaFXML

Is it possible to style columns individually in a tableview? I have been attempting to make some column headers left-aligned and others right-aligned, as shown below: | hdr1 | hdr2 | hdr3 | hdr4 | In my css stylesheet, I experimented with the following ...

Best practices for displaying JSON in an HTML document

Struggling with implementing jQuery autocomplete in a form with a long list of names in a dropdown select tag. The current code is not functioning as expected. public function executeNew($r) { $this->getResponse()->setContentType('applicat ...

Undo a CSS transition when clicked

There is a div named learn-more which expands to fill the whole page when a CSS class is added like this: .learn-more{ padding:10px; font-size: 20px; text-align: center; margin-top:20px; font-family: klight; -webkit-transition:2s; ...

Does HTML5 officially provide the speechsynthesis API for users?

Can someone clarify if speech synthesis is officially supported by HTML5 for converting text-to-speech? ...

The sidebar's background is cut off before reaching the bottom when scrolling

I have been working on creating a sidebar that includes a background image with a transparent overlay. However, I encountered an issue where the overlay background does not stretch all the way to the bottom when the scroll bar becomes visible. Despite sett ...

Is it possible to change the order of elements in the navbar using HTML/Bootstrap depending on the state of the responsive menu toggle?

I am attempting to implement a responsive Bootstrap 4 navbar within Angular 8. When the menu is closed, the element order is correct: COMPANY, BROWSE, LOGIN The issue arises when I open the menu and the #menu receives the navbar-collapse flex attributes: ...

Having trouble with playing an mp4 video from Amazon S3 in an HTML video tag?

I have uploaded a video to S3 from my Android device, but it is not playing properly in HTML on Chrome. Here is the link to the video: ...

Issue with Bootstrap carousel control not switching back to the previous slide

Interestingly, the carousel is functioning for sliding to the next slide but not for going back to the previous one. I'm still getting the hang of jsfiddle, as you can see, highlighting works for the next slide but not for the previous. Check out the ...

Display a different div when hovering over an li element

Within my HTML, I have two div elements. The first div is filled with Menu items represented by li elements, while the second div contains submenus. My desired functionality involves displaying the submenu when hovering over a menu item's li element u ...

JavaScript: How to Build a Digital Grocery List with Browser Storage

Struggling with a tough exercise question, I could use some help deciphering it. https://i.stack.imgur.com/V5he2.png Here is how I've started the code: <!DOCTYPE html> <html> <head> <title></title> <script> fun ...

The transition balance for <TSActivityMapVC: 0x81b1000> is out of sync with mismatched begin/end calls

When initializing the UITabBarController with each tab containing a UINavigationController, and each UINavigationController including a UIViewController. When performing an action in the UIViewController like: TSActivityDetailsVC * c = [[TSActivityDetails ...