Experiment interrupted by svg border

How can I ensure that text always appears in an SVG tag, even if it extends beyond the boundaries? Check out this jsfiddle example where you can see how the text gets cut off. Any suggestions on how to fix this?

<div class="chart">
    <svg height="300" width="300">
        <text y='10' x="96">Blah Blah</text>
    </svg>
</div>  

text {
   font-family: Arial;
   font-size: 20px;
   font-weight: bold;
   fill: #000;
   text-align: center;
   color: #000;
}

.chart {
   box-sizing: border-box;
   height: 98%;
   width: 100%;
   margin-top: 9rem;
 }

Answer №1

check out this code snippet DEMO

<html>
<div id="thumbs-icon">  
                <svg id="icon-thumb">
                <g>
                    <rect class="rect" width="8" height="5" fill="rgb(102,102,102)" x="0" y="0" >    </rect>
                    <rect class="rect" width="8" height="5" fill="rgb(102,102,102)" x="10" y="0" ></rect>
                    <rect class="rect" width="8" height="5" fill="rgb(102,102,102)" x="0" y="7" ></rect>
                    <rect class="rect" width="8" height="5" fill="rgb(102,102,102)" x="10" y="7" ></rect>
                </g>
            </svg>
            <section id="text-thumb">Thumbs</section>
        </div>
</html>


#thumbs-icon {
    width: 15%;
    overflow: hidden;
    margin: 0 auto;
    cursor: pointer;
}   

#thumbs-icon:hover g rect {
    fill: rgb(255, 51, 153);
}

#thumbs-icon:hover {
    color: rgb(255, 51, 153);
}

#icon-thumb {
    width: 20px;
    height: 15px;
    margin-top: 1.5em;
    opacity: 1; 
    float: left;
}

#text-thumb {
    width: 40%;
    float: left;
    font-family: Helvetica, Arial, sans-serif;
    font-size: 20px;
    margin-top: 1em;
}

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

How can I ensure that my Bootstrap 4 column adjusts to its content appropriately?

In the following container, there are two rows: the first row serves as the header, and the second row contains a left navigation bar and main content on the right side. The left nav bar is designed to shrink to the width of the content. By pressing a tog ...

Leveraging HTML in the category name field of WordPress

Seeking assistance in embedding HTML code into the Category names of my Wordpress theme, with the intention of defining the name as an icon using Twitter Bootstrap. An example of the desired code is: <a href="link"> <i class="icon-briefcase"> ...

Discovering the Javascript Code Executing on a <span> element with the Help of Chrome Inspector or Firebug

I have encountered a situation where a website is dynamically generating information into <span></span> tags using jQuery. The span has a class of "Price" and an id corresponding to a Product Code, with the data being pulled from a JSON data sh ...

The border-radius property in Bootstrap buttons causes unwanted white border artifacts to appear

Strange anomalies in the borders of my Bootstrap buttons caught my attention recently. Upon further investigation, I realized that this issue is not linked to my custom styles or theme, as the artifacts can also be seen on the Bootstrap button documentatio ...

Tips on accessing a particular value from an HTML header

My current task involves using selenium to extract request headers from a web page. However, I am facing an issue where all request headers are being printed out, whereas I only need one specific value from them. Despite searching online, I have been unabl ...

Steps for eliminating the #id from a URL page

Can someone assist me in removing or hiding my #id from the URL browser? For example: My menu1 targets "#p1" My site is "mysite.com/index.htm" When I click menu1 on my browser, it will show as "mysite.com/index.htm#p1" I want my id to not show on the U ...

Do not apply transitions to a pseudo-class in CSS

Can a pseudo-class with the same property as another pseudo-class be prevented from being transitioned? Take a look at this example code: button { height: 50px; width: 150px; font-size: 20px; color: white; border: none; background-color: b ...

How can I utilize JavaScript to substitute brackets within a particular attribute in HTML?

Have a look at this snippet of HTML code: <div> <a href="TOTO/{{CODE}}/TOTO/{{CLICK}}/{{OPEN}}" data-href="TOTO/{{CODE}}/TOTO/{{CLICK}}/{{OPEN}}">FOO1</a> </div> <div> <a href="{{CODE}}/{{CLICK}}/BAR" data-href="{{ ...

Ways to display the page's content within a div container utilizing Jquery

I am attempting to display the content of a URL page (such as ) within a <div> using JQuery, but so far I have been unsuccessful. Here is an example of what I am trying to achieve: <div id="contUrl"> .. content of google.fr page </div> ...

Fade-In and Fade-Out CSS Effect with Background Images Displaying a Blank Last Image

I've been experimenting with applying a CSS-only background image transition to a div, but I encountered an issue where after cycling through three specified images, the background reverts back to the original black color. Even stranger, when I adjust ...

Guide on breaking a th tag as a line in a table using CSS

I'm attempting to achieve jQuery datatable-style responsiveness in an Angular table child component. I managed to separate the td and th separately using absolute and relative positions but encountered an issue where the th tag is not breaking at the ...

Transitioning hover text causes rows to shift downwards (Bootstrap)

I can't figure out why my col-sm-4 elements are moving downward when transitioning. It seems like there might be a conflict in one of the class properties, resulting in excessive height for each box. UPDATE: The page has been revised and the issue w ...

Is there a way for me to send a form containing pre-existing data from a different page?

Seeking advice: I realize that utilizing jQuery's ajax function may be the simplest approach, however I am facing an issue with the form field names. The var_dump below displays the typical values submitted by the form using test data. It appears that ...

Utilizing Javascript to maintain an ongoing sum within a <span> tag

I'm working on a code snippet to create a running total feature. Essentially, every time a user clicks a button to add the subtotal to the total, I want it to keep accumulating in the running total. Currently, the setup involves a dropdown menu with t ...

Utilizing Cascading Style Sheets for customizing a numbered list

I am looking to create HTML that will generate the following output: OL { counter-reset: numeric } OL LI OL LI OL { counter-reset: latin } LI { display: block } LI:before { content: counters(numeric, ".") " "; counter-increment: numer ...

I desire to share the JSON information and receive the corresponding response data

<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta charset="utf-8"> <title></title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> </head> ...

Vuetify's v-badge showcasing an exceptionally large number in style

Encountering an issue with using v-badge and v-tab when dealing with large numbers in a v-badge. Managed to find a CSS workaround by setting width: auto; for adjusting the size of v-badge to accommodate huge numbers, but now facing an overlap with my v-ta ...

Tips on automating clicking the cookie button using Selenium?

Currently, I am attempting to extract data from the following website. I need to access various subpages, but some of them are hidden behind a "load more" button. I decided to use Selenium to click the button, but I am encountering difficulty with getting ...

What is the best method to implement a loading spinner within a React and Node application while using Nodemailer?

Is it possible to implement a functionality where clicking the Send button triggers a spinner next to the button, followed by changing the button text to "Message Sent"? I managed to change the button text, but there is no loading time, it happens instantl ...

Why isn't the ajax table showing up in my HTML?

I am facing an issue while trying to run an application that involves AngularJS, Ajax, and a Java Controller returning JSON. Despite my efforts, the table is not displaying in the HTML. I am new to working with Ajax and AngularJS, and need assistance troub ...