In my current scenario, I have a fieldset that is inline with another one on the page. The specific fieldset in question contains an SVG circle and some text.
My objective is to have both elements inline with each other, while allowing the fieldset to adjust its size based on changes I want to make to the text within <span>
/<p>
tags and the color of the circle, depending on a function that returns true or false.
The code I am currently working with is as follows:
<div>
<fieldset class="fieldset-auto-width">
<legend>some legend</legend>
<div>
<svg height="32" width="32"><circle id="circle" cx="16" cy="16" r="15" stroke="#333" stroke-width="1" fill="#ffbf00"/></svg>
</div>
<span>some text</span>
</fieldset>
</div>
Here is the JSFiddle link to view the code along with CSS styles.
I have been struggling for about half an hour trying to figure out if the second div wrapping the SVG element is necessary. Initially, I included it to set a maximum size for the SVG element due to unwanted space, even with style="display: block"
My ultimate goal is to align my SVG circle and <span>
element inline together.
I am using <span>
instead of <p>
at the moment to minimize the excessive space below the SVG. This issue is less problematic when using a <span>
compared to a <p>
.
Edit: The previous JSFiddle link was incorrect.