What is the best way to arrange an animated SVG image behind a Foundation 6 element?

Is there a way to incorporate the Foundation grid while also adding a larger element that stands out from other elements? This large object acts as part of the background, but it's an animated svg, so setting it as a background is not possible.

There are two examples in the CodePen. The first(top) one includes the Foundation grid with the white, mostly transparent, svg circle I am attempting to integrate. The second(bottom) example does not use the Foundation grid but correctly displays the background circle (#bg-circle).

I have experimented with using z-index to achieve this effect, but haven't had any success.

View the CodePen here

<!-- View the CodePen -->

Answer №1

To incorporate an SVG as a background image, it is recommended to utilize a larger container and then apply foundation's grid system over it. Here is an example:

HTML setup:

<div id="container">
    <svg>...</svg>
</div>

<div id="row-container">
    <div class="row">
         <div class="columns ..."></div>
    </div>
</div>

CSS styling:

#container {
    position: relative;
}

#row-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

Answer №2

Bring Life to Your SVG by Using Animation Effects

The Key Information for Your Query: Check out this helpful YouTube tutorial that demonstrates how to animate an SVG image using Adobe Illustrator (although there are other methods available as well):

Tutorial on Creating and Animating SVG Files

Additionally, Here is the Mozilla Guide on Incorporating Animation specifically utilizing the animateTransform element:

Mozilla's Documentation on SVG animateTransform

<?xml version="1.0"?>
<svg width="120" height="120"  viewBox="0 0 120 120"
     xmlns="http://www.w3.org/2000/svg" version="1.1"
     xmlns:xlink="http://www.w3.org/1999/xlink" >

    <polygon points="60,30 90,90 30,90">
        <animateTransform attributeName="transform"
                          attributeType="XML"
                          type="rotate"
                          from="0 60 70"
                          to="360 60 70"
                          dur="10s"
                          repeatCount="indefinite"/>
    </polygon>
</svg>

Incorporating an SVG Image as a Background Is Simple:

Example of CodePen with SVG Background Image

Below is HTML and CSS provided as a demonstration:

<div class="svgEx marg">
    <div class="row">
      <div class="small-2 large-4 columns">Add text here.</div>
      <div class="small-4 large-4 columns">More text goes here.</div>
      <div class="small-6 large-4 columns">Even more text over here.</div>
    </div>
    <div class="row">
      <div class="small-2 large-4 columns">Insert text here.</div>
      <div class="small-4 large-4 columns">Additional text here.</div>
      <div class="small-6 large-4 columns">Even more text here.</div>
    </div>
    <div class="row">
      <div class="small-2 large-4 columns">Some text here.</div>
      <div class="small-4 large-4 columns">Extra text here.</div>
      <div class="small-6 large-4 columns">Even more text here.</div>
    </div>  
</div>

CSS Styling:

.svgEx {
  background: url(https://ohdoylerules.com/content/images/css3.svg) no-repeat center center;
  min-height: 500px;
}

.marg { padding: 100px 0;}

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

Fetching large images with "fill" layout in NextJS

I am currently using Cloudinary to serve correctly sized images, however, it appears that NextJS image is always fetching with a width of 3840, instead of the fixed value. <Image src={loaderUrl(logoImage)} alt="" role="presen ...

display a tooltip for a disabled image hyperlink in JSP

I am currently working on a popup menu that displays different images, each with its own unique link. Here is an example of what a single menu element looks like: <li class="button-link" data-idp="idfirst"> <s:a href='%{l ...

Issues with Google Fonts failing to load correctly

Would you mind taking a look at this issue for me? In all browsers except Firefox, the expected behavior is that a web font remains invisible until fully loaded, preserving space on the page. Interestingly, in Chrome and IE9 (the browsers I tested), ther ...

Picture placed outside div within infobubble

I'm currently working with Google Maps to display an InfoWindow using the InfoBubble library. The issue I'm encountering is that when I try to show an image outside of a div using CSS properties, only half of the image displays within the div. B ...

Is there a way to apply a setTimeout to a <div> element upon the first click, but not on subsequent clicks?

Check out the fiddle I've created: http://jsfiddle.net/dkarasinski/dj2nqy9c/1/ This is the basic code. I need assistance with a functionality where clicking on a black box opens a black background and then after 500ms a red box appears. I want the ...

Ensure that the headers of the table are in perfect alignment with the

Is there a way to create a table with fixed row headers so that column headings stay in place while scrolling? I've managed to achieve this, but now the table headers are not aligned properly with the rows below. I've also created a helpful jsfid ...

Find the string "s" within a div element aligned vertically, using Popper

Currently utilizing Popper from Material-UI <Popper id={"simplePopper"} open={true} style={{backgroundColor: 'red',opacity:'0.5',width:'100%',height:'100%'}}> <div style={{height:"100%", ...

Dynamically switch between showing more and showing less content on each div

Whenever the specific show more button is clicked, the content should be displayed without causing the entire component to re-render. I have tried using a useState, but each time the button is clicked, the whole component re-renders, resulting in long load ...

Having difficulty adjusting certain internal styles within Material UI's <Dialog> component

I want to customize the styling of my <Dialog> component by adding rounded corners using a border radius. Here is the inline style I am trying to apply to override the default styles of the <Dialog>: let overrideStyles = { padding: 0, marg ...

Are there any React-UI libraries that come with a stylish green color scheme?

Currently working on a small React site and deciding on a UI library. While I do like Material UI and Bootstrap, I find that they have limited default themes available. I am looking for libraries with green-color-based themes or ones that make it easy to ...

Implement a style to all elements except for the special element

Learn HTML <ul id="tree"> <li> <label> <input type="checkbox" /> Level 1 - 1</label> </li> <li> <label> <input type="checkbox" /> Level 1 - 2</lab ...

Crafting hover effects in Dreamweaver

Looking for a hover-over tutorial that divides the page in half? Check out these two diagrams below: https://i.sstatic.net/bkR1f.jpg https://i.sstatic.net/bqClq.png Basically, when hovering over any of the 3 buttons, I want to display another list of but ...

Include the circle.css file in the Angular 4 project by loading it in the head section of the

I am currently working with Angular 4 and would like to incorporate the circle.css styles from cssscript. After downloading the file from the provided link, I placed the circle.css within my something component file. However, when attempting to use &l ...

"Unlock the secrets to commanding respect in the web form layout by mastering the art

I have a fieldset that includes a legend with potentially long text content. I need the legend to only take up 50% of the width of the fieldset. Currently, when the legend is too lengthy, it still occupies 50% of the space but causes the entire fieldset ...

Divided Progress Indicators in Bootstrap 3

Looking to enhance user experience on my webpage by creating a progress bar for data entry. The goal is for users to enter 10 items before proceeding. The challenge I'm facing is developing a progress bar that accurately reflects the number of items ...

What could be causing my carousel to malfunction?

Can someone assist me, please? I am having an issue where the carousel displays on the page, but the images are not showing and the buttons do not work. Please refer to the CSS + HTML snippet below: #my-carousel .carousel-inner .item { width: 100%; ...

The nested CSS grid is failing to show its nested elements on the page

Having trouble with a nested CSS GRID - the child grid items are not appearing correctly despite multiple checks on the markup. The first grid row should span three columns, as it does, and is set to display:grid with 2 child grid items. However, the chil ...

Is there a more effective method for placing text below an image?

I've been struggling to figure this out. Initially, when I attempted to keep the text below the image, it was constantly floated to the left. While this code seems to be effective, I suspect I made an error because when the width of .resmontage ul is ...

Elements resize based on their parent's and siblings' widths

I have organized the parent div and its three children divs. Presently, the third child is concealed. I've designated the width of the first child as 20% and desire for the second child to automatically take up the remaining width without explicit set ...

Achieve a sliding effect between two divs using CSS only

I'm trying to create a design with 2 divs that are the same size. The first one is visible by default, while the second one is hidden initially. My goal is to achieve an effect where when you hover over the first div, the second one slides upward and ...