Why do I get very different results for SVG path i.e. vs chrome? - svg

Hi I have this SVG path and it works perfectly in IE (oddly) but only displays a tiny line in Chrome. Any help appreciated!
<svg class="svgs" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><path style="stroke:#ff0000; fill:none;" d="M428 237L200 500"/></svg>
style:
.svg {
z-index: 1;
position: absolute;
top: 0px;
left: 0px;
}

You've not specified a height or width (or a viewBox).
The default canvas size is 300 x 150px and you're mostly drawing outside of that.
Looks like Chrome (and Firefox) default to overflow: hidden; whereas IE defaults to overflow: visible
Best specify a size and restrict your drawing to that size.

Related

Changing svg dimensions with styled component mediaquery does not update viewBox

Example
import styled from 'styled-components';
import { ReactComponent as SvgLogoUnstyled } from 'src/assets/svg/logo.svg';
const SvgLogo = styled(SvgLogoUnstyled)`
height: 40px;
width: 40px;
#media (max-width:1427px){
width: 17px;
height: 17px;
}
`;
export default SvgLogo;
When changing screen size, the svg viewBox remains at 40px, but gets cropped at 17px.
In html css this does not happen. Both the viewBox and dimensions get updated.
Can anyone advise a fix?
Note: Using transform scale - does not resolve this problem, because it keeps the width at 40px which adds unnecessary margin, when I do actually need the logo to be at 17px width.
transform: scale(0.42); /*17 / .4*/
I have managed to hack it a little but its ugly
#media (max-width:1427px){
transform: scale(0.42); /* transform: scale(0.42); /*17 / .4*/
margin: 0 -12px 0 4px; /* added minus margin to reset ( (40 - 17) / 2)*/
box-sizing: content-box; /* enable expansion without cropping if additional margin top/bottom*/
}
Ok it turned out to be simple.
I was using css to set the width and height and change it on mediaquery, but the actual svg itself had a width,height on it. Simply removing the width, height from the svg, but keeping the viewBox, ensured the svg retained its aspect ratio.
Answer here: https://css-tricks.com/scale-svg/
Point going forward, when creating svgs, remove the width, height attributes from them before inserting into html and always use css to set the dimensions.

PagerSetting at the bottom of a grid does not display correct

Is there a way to fix the vertical layout of the PagerSettings when displayed at the bottom of a grid?
UPDATE: I am working on build 19.110.0013
I am trying to add numbers to the bottom of a grid using the PagerSettings tag described in the post Add page numbers to the bottom of Process Shipments grid. When I set the PagerVisible to bottom the numbers display vertical, but if I set the PagerVisible to top the numbers are properly displayed as horizontal.
<ActionBar PagerVisible="Bottom" DefaultAction="cmdItemDetails">
<PagerSettings Mode="Numeric" LinksCount="5" />
</ActionBar>
I could not reproduce that behavior in Acumatica version 19.106.0020 so I manually tweaked the CSS in order to reproduce that glitch.
Setting 'display: block' CSS property on GridPagerLink CSS class reproduces the same rendering.
In file '\App_Themes\Default\00_Controls.css' it is set as 'display: inline-block;'.
Inline option will make them stack horizontally so I don't have this glitch on my side.
Which exact Acumatica version are you running?
Use browser HTML inspect element feature to inspect the GridPagerLink.
Does it look like the default style below?
.GridPagerLink {
display: inline-block;
color: RGBA(0, 0, 0, 0.87);
text-decoration: none;
font-size: 15px;
font-weight: bold;
padding: 5px 10px;
height: 18px;
border: solid 1px transparent;
}

Non-react-leaflet overlay on map

just getting started on react-leaflet and leaflet. After clicking on a marker I want to have a full screen overlay above the map to display a graph. But no matter how I set z-index of the and , the overlay always lies below the map.
Couldn't find an answer as most z-index question apply to map layers etc. within the component.
.overlay-wrapper {
position: fixed;
display: block;
width: 100%;
height: 100%;
top: 0;
left: 0;
background-color: rgba(0,0,0,0.5);
z-index: 200;
cursor: pointer;}
It should be pretty straight forward, please point me in the right direction.
As #andreasgroos mentioned in their comment, the z-index value needs to be high enough, i.e. 401 or higher. z-index: "2000 !important" should guarantee that the component will be rendered over the map.

CSS border - but width limited to text

I'm currently developing a site which requires headings as such:
My initial idea was to do this with border-bottom, but how would I limit the width of the border so that it doesn't go all the way across? The border needs to stop when it gets to the text.
Is this possible?
h1 {
background-color: #fff;
line-height: 1;
margin: 0;
display: inline;
position:relative;
z-index: 1;
}
h1:after {
content: '';
display: block;
border-bottom: 2px solid;
position: relative;
z-index: 0;
margin-top: -7px;
}
The length of the border is decided by the size of the element it is bordering. You could create another <div> inline with the text with border-bottom: 1px; and the other borders set to 0. You could then change the margin or width of the <div> to alter the length of the line. Note that you'd have to set a width, because an empty <div> has a width of 0 by default, so won't display.
Another possible (but not recommended) way to do it would be to use a <hr> but these are not well supported in HTML 5, so I would choose the first method personally.
A solution I can come up with is to give the title the same background-color as the page's background, and then to either transform: scale() the title up so that it overflows with the border of its parent, either scale the parent down so that its border hides behind the title's background.
See here for an example:
http://jsfiddle.net/WjRqC/1/
Oh, also, scaling can be replaced by making the title position: relative and moving it downwards a few pixels (and giving it a bit more vertical padding if you don't want the text too close to the line). Actually this is probably a better idea than scaling, because it's not CSS3, so it's more compatible.
Lookie here:
http://jsfiddle.net/7affw/1/

Overlaying opaque image over background

I am quite new to XHTML/CSS, but have now got my site laid out nicely. Just one loose end which I can't seem to get past (I've spent a fair bit of time on this & found related info, but nothing quite the same):
All I want to do is overlay a faint image on my background. I don't want to use the "opaque" filters, as they trigger the script security alert on my IE Explorer 8.
I am quite happy to use the opaque gif image I have created.
I can see that z-index is the way to go. However, my image area insists on locating further down the page rather than overlaying.
Here's what I think are the key extracts of the code where I am going wrong [I have snipped detail such as fonts]:
HTML:
body { position:relative; z-index:1;
margin: 0 20px 0 0;
padding: 0;
background: #FFFFFF url(images/ge01.jpg) repeat-y;[snip]}
<div id="transparency">
</div>
CSS:
#transparency {
url(images/transparency.jpg) no-repeat;
width:230px;
height: 1000px;
position: relative; top: 80px; left:0;
z-index:2;
}
Have you tried using position: absolute; on your transparency element?
position: relative means that you will position the transparent element in relation to other content.

Resources