svg cursor pointer missing between two sub-component
up vote
-1
down vote
favorite
@namespace svgns url(http://www.w3.org/2000/svg);
html,body,svg { height:100% }/* As SVG does not provide a default visual style for links,
it's considered best practice to add some */
@namespace svgns url(http://www.w3.org/2000/svg);
svgns|a {
cursor: pointer;
}
svgns|a text {
fill: blue; /* Even for text, SVG use fill over color */
text-decoration: underline;
}
svgns|a:hover, svgns|a:active {
outline: dotted 1px blue;
}<!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a -->
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- A link around a text -->
<a href="https://developer.mozilla.org/docs/Web/SVG/Element/circle">
<g style="cursor: pointer">
<image xlink:href="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" height="50" width="50"/>
<text x="50" y="90" text-anchor="middle">
<circle>
</text>
</g>
</a>
</svg>I have an SVG, it contains animage as well as text. the SVGhas style { cursor: pointer}.
When I hover on the image, I can have cursor pointer, same to the text. But if I hover on that space between the image and text, I lose the "hand".
Is there any way I can have it?
Thanks for the help.
example
enter code here
svg
New contributor
jack is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
up vote
-1
down vote
favorite
@namespace svgns url(http://www.w3.org/2000/svg);
html,body,svg { height:100% }/* As SVG does not provide a default visual style for links,
it's considered best practice to add some */
@namespace svgns url(http://www.w3.org/2000/svg);
svgns|a {
cursor: pointer;
}
svgns|a text {
fill: blue; /* Even for text, SVG use fill over color */
text-decoration: underline;
}
svgns|a:hover, svgns|a:active {
outline: dotted 1px blue;
}<!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a -->
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- A link around a text -->
<a href="https://developer.mozilla.org/docs/Web/SVG/Element/circle">
<g style="cursor: pointer">
<image xlink:href="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" height="50" width="50"/>
<text x="50" y="90" text-anchor="middle">
<circle>
</text>
</g>
</a>
</svg>I have an SVG, it contains animage as well as text. the SVGhas style { cursor: pointer}.
When I hover on the image, I can have cursor pointer, same to the text. But if I hover on that space between the image and text, I lose the "hand".
Is there any way I can have it?
Thanks for the help.
example
enter code here
svg
New contributor
jack is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
You can addcursor: pointerto entiresvgelement if you do not have any other elements in svg.
– extempl
yesterday
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
@namespace svgns url(http://www.w3.org/2000/svg);
html,body,svg { height:100% }/* As SVG does not provide a default visual style for links,
it's considered best practice to add some */
@namespace svgns url(http://www.w3.org/2000/svg);
svgns|a {
cursor: pointer;
}
svgns|a text {
fill: blue; /* Even for text, SVG use fill over color */
text-decoration: underline;
}
svgns|a:hover, svgns|a:active {
outline: dotted 1px blue;
}<!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a -->
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- A link around a text -->
<a href="https://developer.mozilla.org/docs/Web/SVG/Element/circle">
<g style="cursor: pointer">
<image xlink:href="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" height="50" width="50"/>
<text x="50" y="90" text-anchor="middle">
<circle>
</text>
</g>
</a>
</svg>I have an SVG, it contains animage as well as text. the SVGhas style { cursor: pointer}.
When I hover on the image, I can have cursor pointer, same to the text. But if I hover on that space between the image and text, I lose the "hand".
Is there any way I can have it?
Thanks for the help.
example
enter code here
svg
New contributor
jack is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
@namespace svgns url(http://www.w3.org/2000/svg);
html,body,svg { height:100% }/* As SVG does not provide a default visual style for links,
it's considered best practice to add some */
@namespace svgns url(http://www.w3.org/2000/svg);
svgns|a {
cursor: pointer;
}
svgns|a text {
fill: blue; /* Even for text, SVG use fill over color */
text-decoration: underline;
}
svgns|a:hover, svgns|a:active {
outline: dotted 1px blue;
}<!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a -->
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- A link around a text -->
<a href="https://developer.mozilla.org/docs/Web/SVG/Element/circle">
<g style="cursor: pointer">
<image xlink:href="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" height="50" width="50"/>
<text x="50" y="90" text-anchor="middle">
<circle>
</text>
</g>
</a>
</svg>I have an SVG, it contains animage as well as text. the SVGhas style { cursor: pointer}.
When I hover on the image, I can have cursor pointer, same to the text. But if I hover on that space between the image and text, I lose the "hand".
Is there any way I can have it?
Thanks for the help.
example
enter code here
@namespace svgns url(http://www.w3.org/2000/svg);
html,body,svg { height:100% }/* As SVG does not provide a default visual style for links,
it's considered best practice to add some */
@namespace svgns url(http://www.w3.org/2000/svg);
svgns|a {
cursor: pointer;
}
svgns|a text {
fill: blue; /* Even for text, SVG use fill over color */
text-decoration: underline;
}
svgns|a:hover, svgns|a:active {
outline: dotted 1px blue;
}<!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a -->
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- A link around a text -->
<a href="https://developer.mozilla.org/docs/Web/SVG/Element/circle">
<g style="cursor: pointer">
<image xlink:href="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" height="50" width="50"/>
<text x="50" y="90" text-anchor="middle">
<circle>
</text>
</g>
</a>
</svg>@namespace svgns url(http://www.w3.org/2000/svg);
html,body,svg { height:100% }/* As SVG does not provide a default visual style for links,
it's considered best practice to add some */
@namespace svgns url(http://www.w3.org/2000/svg);
svgns|a {
cursor: pointer;
}
svgns|a text {
fill: blue; /* Even for text, SVG use fill over color */
text-decoration: underline;
}
svgns|a:hover, svgns|a:active {
outline: dotted 1px blue;
}<!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a -->
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- A link around a text -->
<a href="https://developer.mozilla.org/docs/Web/SVG/Element/circle">
<g style="cursor: pointer">
<image xlink:href="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" height="50" width="50"/>
<text x="50" y="90" text-anchor="middle">
<circle>
</text>
</g>
</a>
</svg>svg
svg
New contributor
jack is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
jack is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited yesterday
Blaze
2,446324
2,446324
New contributor
jack is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked yesterday
jack
1
1
New contributor
jack is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
jack is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
jack is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
You can addcursor: pointerto entiresvgelement if you do not have any other elements in svg.
– extempl
yesterday
add a comment |
You can addcursor: pointerto entiresvgelement if you do not have any other elements in svg.
– extempl
yesterday
You can add
cursor: pointer to entire svg element if you do not have any other elements in svg.– extempl
yesterday
You can add
cursor: pointer to entire svg element if you do not have any other elements in svg.– extempl
yesterday
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
You can apply cursor: pointer to entire svg element if this is all content you have in svg.
Otherwise, you can add a simple rect before the image:
<rect x="0" y="0" width="100" height="100" fill="transparent" />
As the g element can't be styled directly, as styles apply to nested elements only, but rect can be (and as a nested element of g as well).
@namespace svgns url(http://www.w3.org/2000/svg);
html,
body,
svg {
height: 100%
}
/* As SVG does not provide a default visual style for links,
it's considered best practice to add some */
svgns|a {
cursor: pointer;
}
svgns|a text {
fill: blue;
/* Even for text, SVG use fill over color */
text-decoration: underline;
}
svgns|a:hover,
svgns|a:active {
outline: dotted 1px blue;
}<!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a -->
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- A link around a text -->
<a href="https://developer.mozilla.org/docs/Web/SVG/Element/circle">
<rect x="0" y="0" width="100" height="100" fill="transparent" />
<image xlink:href="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" height="50" width="50"/>
<text x="50" y="90" text-anchor="middle">
<circle>
</text>
</a>
</svg>add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You can apply cursor: pointer to entire svg element if this is all content you have in svg.
Otherwise, you can add a simple rect before the image:
<rect x="0" y="0" width="100" height="100" fill="transparent" />
As the g element can't be styled directly, as styles apply to nested elements only, but rect can be (and as a nested element of g as well).
@namespace svgns url(http://www.w3.org/2000/svg);
html,
body,
svg {
height: 100%
}
/* As SVG does not provide a default visual style for links,
it's considered best practice to add some */
svgns|a {
cursor: pointer;
}
svgns|a text {
fill: blue;
/* Even for text, SVG use fill over color */
text-decoration: underline;
}
svgns|a:hover,
svgns|a:active {
outline: dotted 1px blue;
}<!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a -->
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- A link around a text -->
<a href="https://developer.mozilla.org/docs/Web/SVG/Element/circle">
<rect x="0" y="0" width="100" height="100" fill="transparent" />
<image xlink:href="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" height="50" width="50"/>
<text x="50" y="90" text-anchor="middle">
<circle>
</text>
</a>
</svg>add a comment |
up vote
0
down vote
You can apply cursor: pointer to entire svg element if this is all content you have in svg.
Otherwise, you can add a simple rect before the image:
<rect x="0" y="0" width="100" height="100" fill="transparent" />
As the g element can't be styled directly, as styles apply to nested elements only, but rect can be (and as a nested element of g as well).
@namespace svgns url(http://www.w3.org/2000/svg);
html,
body,
svg {
height: 100%
}
/* As SVG does not provide a default visual style for links,
it's considered best practice to add some */
svgns|a {
cursor: pointer;
}
svgns|a text {
fill: blue;
/* Even for text, SVG use fill over color */
text-decoration: underline;
}
svgns|a:hover,
svgns|a:active {
outline: dotted 1px blue;
}<!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a -->
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- A link around a text -->
<a href="https://developer.mozilla.org/docs/Web/SVG/Element/circle">
<rect x="0" y="0" width="100" height="100" fill="transparent" />
<image xlink:href="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" height="50" width="50"/>
<text x="50" y="90" text-anchor="middle">
<circle>
</text>
</a>
</svg>add a comment |
up vote
0
down vote
up vote
0
down vote
You can apply cursor: pointer to entire svg element if this is all content you have in svg.
Otherwise, you can add a simple rect before the image:
<rect x="0" y="0" width="100" height="100" fill="transparent" />
As the g element can't be styled directly, as styles apply to nested elements only, but rect can be (and as a nested element of g as well).
@namespace svgns url(http://www.w3.org/2000/svg);
html,
body,
svg {
height: 100%
}
/* As SVG does not provide a default visual style for links,
it's considered best practice to add some */
svgns|a {
cursor: pointer;
}
svgns|a text {
fill: blue;
/* Even for text, SVG use fill over color */
text-decoration: underline;
}
svgns|a:hover,
svgns|a:active {
outline: dotted 1px blue;
}<!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a -->
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- A link around a text -->
<a href="https://developer.mozilla.org/docs/Web/SVG/Element/circle">
<rect x="0" y="0" width="100" height="100" fill="transparent" />
<image xlink:href="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" height="50" width="50"/>
<text x="50" y="90" text-anchor="middle">
<circle>
</text>
</a>
</svg>You can apply cursor: pointer to entire svg element if this is all content you have in svg.
Otherwise, you can add a simple rect before the image:
<rect x="0" y="0" width="100" height="100" fill="transparent" />
As the g element can't be styled directly, as styles apply to nested elements only, but rect can be (and as a nested element of g as well).
@namespace svgns url(http://www.w3.org/2000/svg);
html,
body,
svg {
height: 100%
}
/* As SVG does not provide a default visual style for links,
it's considered best practice to add some */
svgns|a {
cursor: pointer;
}
svgns|a text {
fill: blue;
/* Even for text, SVG use fill over color */
text-decoration: underline;
}
svgns|a:hover,
svgns|a:active {
outline: dotted 1px blue;
}<!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a -->
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- A link around a text -->
<a href="https://developer.mozilla.org/docs/Web/SVG/Element/circle">
<rect x="0" y="0" width="100" height="100" fill="transparent" />
<image xlink:href="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" height="50" width="50"/>
<text x="50" y="90" text-anchor="middle">
<circle>
</text>
</a>
</svg>@namespace svgns url(http://www.w3.org/2000/svg);
html,
body,
svg {
height: 100%
}
/* As SVG does not provide a default visual style for links,
it's considered best practice to add some */
svgns|a {
cursor: pointer;
}
svgns|a text {
fill: blue;
/* Even for text, SVG use fill over color */
text-decoration: underline;
}
svgns|a:hover,
svgns|a:active {
outline: dotted 1px blue;
}<!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a -->
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- A link around a text -->
<a href="https://developer.mozilla.org/docs/Web/SVG/Element/circle">
<rect x="0" y="0" width="100" height="100" fill="transparent" />
<image xlink:href="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" height="50" width="50"/>
<text x="50" y="90" text-anchor="middle">
<circle>
</text>
</a>
</svg>@namespace svgns url(http://www.w3.org/2000/svg);
html,
body,
svg {
height: 100%
}
/* As SVG does not provide a default visual style for links,
it's considered best practice to add some */
svgns|a {
cursor: pointer;
}
svgns|a text {
fill: blue;
/* Even for text, SVG use fill over color */
text-decoration: underline;
}
svgns|a:hover,
svgns|a:active {
outline: dotted 1px blue;
}<!-- Learn about this code on MDN: https://developer.mozilla.org/en-US/docs/Web/SVG/Element/a -->
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<!-- A link around a text -->
<a href="https://developer.mozilla.org/docs/Web/SVG/Element/circle">
<rect x="0" y="0" width="100" height="100" fill="transparent" />
<image xlink:href="https://mdn.mozillademos.org/files/6457/mdn_logo_only_color.png" height="50" width="50"/>
<text x="50" y="90" text-anchor="middle">
<circle>
</text>
</a>
</svg>answered yesterday
extempl
1,2501027
1,2501027
add a comment |
add a comment |
jack is a new contributor. Be nice, and check out our Code of Conduct.
jack is a new contributor. Be nice, and check out our Code of Conduct.
jack is a new contributor. Be nice, and check out our Code of Conduct.
jack is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53183880%2fsvg-cursor-pointer-missing-between-two-sub-component%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
You can add
cursor: pointerto entiresvgelement if you do not have any other elements in svg.– extempl
yesterday