How to create a slanted SVG image with slanted text


very cool

I am trying to create a slanted image in svg with slanted text as shown in the image below

enter image description here

I tried to create the same format but couldn't create the same design as the overall text display, you can also see the columns below attached horizontally down.

Please find my code below

<svg width="100" height="100">
<rect x="10" y="10" width="80" height="30" style="fill:grey;"  transform="rotate(30 20,40)" /> 
<style> .textColor {  fill: white; } </style> 
<text x="50" y="25" text-anchor="middle" font-size="12" class="textColor" stroke-width="0" dy=".3em"  transform="rotate(30 20,40)">overall</text> 
</svg> 

Please find below the image created with this svg, the red part is there I want grey too, I'm short and I want the exact image as shown above.

enter image description here

I need to do this in PDFMake , copy the code below and paste it on the left part of the screen in the PDFMake site, I need to show the exact layout in the first image

var dd = {
    content: [

        {
            style: 'tableExample',
            table: {
                body: [
                    ['OverAll', 'Operational', 'Solvency'],
                    ['1', '1', '1']
                ]
            }
        }
    ]
}
Enxanetta

You can try skewing the rectangle. If you rotate the text and rectangle by 50 degrees, the skew angle should be -90+50 = -40. Note that I have added a viewBox to the svg because the rect part of it is moved outside the svg elelent by tilting and rotating it.

The best solution to your problem (Robert Longson's comment) is probably to draw polygons instead of rectangles in the svg editor.

svg{border:1px solid;}
<svg width="140" height="100" viewBox="-20 0 120 80">
<rect x="10" y="10" width="80" height="30" style="fill:grey;"  transform="rotate(50 20,40) skewX(-40)" /> 
<style> .textColor {  fill: white; } </style> 
<text x="50" y="25" text-anchor="middle" dx="-10" font-size="12" class="textColor" stroke-width="0"  transform="rotate(50 20,40)">overall</text> 
</svg>

Related


How to create a div with slanted text?

Mike Oberdick Okay, I've tried a lot and would like to know what you guys think. Right now, I'm using a floating control to get it working, but that's preventing me from styling the right post with flexbox. Here is what I am trying to create: This is my CSS (c

How to create a div with slanted text?

Mike Oberdick Okay, I've tried a lot and would like to know what you guys think. Right now, I'm using a floating control to get it working, but that's preventing me from styling the right post with flexbox. Here is what I am trying to create: This is my CSS (c

How can I create a slanted slanted header text next to it?

Jarcena .image { min-height: 100vh; } .bg-image { background-image: url('https://picsum.photos/1440/900'); background-size: cover; background-position: center; } <!--About Us --> <div class="container-fluid"> <div class="row no-gutter"> <div cla

How can I create a slanted slanted header text next to it?

Jarcena .image { min-height: 100vh; } .bg-image { background-image: url('https://picsum.photos/1440/900'); background-size: cover; background-position: center; } <!--About Us --> <div class="container-fluid"> <div class="row no-gutter"> <div cla

How can I create a slanted slanted header text next to it?

Jarcena .image { min-height: 100vh; } .bg-image { background-image: url('https://picsum.photos/1440/900'); background-size: cover; background-position: center; } <!--About Us --> <div class="container-fluid"> <div class="row no-gutter"> <div cla

How can I create a slanted slanted header text next to it?

Jarcena .image { min-height: 100vh; } .bg-image { background-image: url('https://picsum.photos/1440/900'); background-size: cover; background-position: center; } <!--About Us --> <div class="container-fluid"> <div class="row no-gutter"> <div cla

How to create a slanted background with CSS?

cannon moyer I am attaching an image to show the exact layout. The lines in the photo are only there to show where the color should be changed. Here's some code I've tried, but it doesn't seem ideal. .block { background-color: black; left: -50; height: 1

How to create a slanted background with CSS?

cannon moyer I am attaching an image to show the exact layout. The lines in the photo are only there to show where the color should be changed. Here's some code I've tried, but it doesn't seem ideal. .block { background-color: black; left: -50; height: 1

How to create a slanted border with CSS

Filip Nilsson I want to cut the border as shown in the image below: The cut out area should be transparent if possible. Here is my current code: .main { height: 50px; background-color: #d6d6d6; } footer { height: 93px; background-color: #ff613

How to create a slanted background with CSS?

cannon moyer I am attaching an image to show the exact layout. The lines in the photo are only there to show where the color should be changed. Here's some code I've tried, but it doesn't seem ideal. .block { background-color: black; left: -50; height: 1

How to slant an element but keep the text normal (not slanted)

Preston Is it possible to replicate this image using only CSS? I want to apply this to the menu, so the brown background appears on the hoverinstance I don't know what to do, I only have. .menu li a:hover{ display:block; background:#1a0000; padd

How to slant an element but keep the text normal (not slanted)

Preston Is it possible to replicate this image using only CSS? I want to apply this to the menu, so the brown background appears on the hoverinstance I don't know what to do, I only have. .menu li a:hover{ display:block; background:#1a0000; padd

Left slanted image in css

magic beans I want an image, but I want it to stay slanted. Check out the image of what I mean: But my current situation is like this: Here is my code: <div class="col-lg-5 col-md-12 col-sm-12"> //SOMETHING HERE </div>

Cairo draws slanted text

fish cairo_move_to (cr, x, y); cairo_show_text (cr, "hello"); You know, a parallel text will be drawn on the axis, but now, I want to draw an slanted text like this: But avoid cairo_rotate, I have two points, start and end, please tell me how to do it, thanks

How to interlock slanted SVGs

Jason Lane I currently have two SVGs that are interlocked with each other, but the higher SVG (the first in the imgur link) acts like a rectangle and the lower SVG (the second image in the imgur link) "Push" away from it and the spacing between them is large (

How to interlock slanted SVGs

Jason Lane I currently have two SVGs that are interlocked with each other, but the higher SVG (the first in the imgur link) acts like a rectangle and the lower SVG (the second image in the imgur link) "Push" away from it and the spacing between them is large (

Make slanted elements on an image transparent

Benjamin Treadwell I've tried following the guide on Youtube for help and I can get it to work - kinda. I'm trying to place two divs in a section where the top is to place the image and the bottom is to place the text etc. What I want is a slanted razor blade

Create partial shadow on slanted div

Kathryn Crawford I'm trying to create a partial shadow on a slanted div and get as close to this creative as possible. Now, I've been trying to do this with pseudo-elements (especially before), but I've found that as long as the element to which they're applie

Create slanted/irregular shaped divs

Jon Kyte I would like to know if it is possible to create this div shape using CSS3. I know you can do things like use borders, but is there anyway to get borders like images (spanning his entire top and bottom of the div) - and bonus points for making it resp

Create slanted/irregular shaped divs

Jon Kyte I would like to know if it is possible to create this div shape using CSS3. I know you can do things like use borders, but is there anyway to get borders like images (spanning his entire top and bottom of the div) - and bonus points for making it resp