How to remove first and last space from text node using Safari?
I just found a problem when viewing a page using Safari. Normally, when I have code like:
<a href="someplace.html">
Someplace
</a>
I expect the browser to render the text as a link with no extra content. That's what Chrome and Firefox do. When using Safari though, that's not the case. Safari adds one space before and one after the text, like the following
.
I know Chrome adds space to the inspector too, but that's not the problem. The problem is that Safari actually renders the whitespace, which is a problem if your content breaks into multiple lines,
.
Is there a way to prevent this from happening or should I modify my code and put everything in a single line in order to avoid this problem?
html css safari
add a comment |
I just found a problem when viewing a page using Safari. Normally, when I have code like:
<a href="someplace.html">
Someplace
</a>
I expect the browser to render the text as a link with no extra content. That's what Chrome and Firefox do. When using Safari though, that's not the case. Safari adds one space before and one after the text, like the following
.
I know Chrome adds space to the inspector too, but that's not the problem. The problem is that Safari actually renders the whitespace, which is a problem if your content breaks into multiple lines,
.
Is there a way to prevent this from happening or should I modify my code and put everything in a single line in order to avoid this problem?
html css safari
It sounds very IE6 to have whitespace render. It used to happen with images. If you have text-decoration:underline do you actually get a _Some neat content_ underline before and after? I would personally always try to be defensive and not have leading and trailing whitespace in a link because I had such issue before
– mplungjan
Nov 14 '18 at 17:27
@mplungjan It's weird. When using "text-decoration: underline" it renders the first space but not the last. It seems to ignore the last one, but fails to do the same with the one at the beginning.
– Daniel Pacheco
Nov 14 '18 at 22:51
add a comment |
I just found a problem when viewing a page using Safari. Normally, when I have code like:
<a href="someplace.html">
Someplace
</a>
I expect the browser to render the text as a link with no extra content. That's what Chrome and Firefox do. When using Safari though, that's not the case. Safari adds one space before and one after the text, like the following
.
I know Chrome adds space to the inspector too, but that's not the problem. The problem is that Safari actually renders the whitespace, which is a problem if your content breaks into multiple lines,
.
Is there a way to prevent this from happening or should I modify my code and put everything in a single line in order to avoid this problem?
html css safari
I just found a problem when viewing a page using Safari. Normally, when I have code like:
<a href="someplace.html">
Someplace
</a>
I expect the browser to render the text as a link with no extra content. That's what Chrome and Firefox do. When using Safari though, that's not the case. Safari adds one space before and one after the text, like the following
.
I know Chrome adds space to the inspector too, but that's not the problem. The problem is that Safari actually renders the whitespace, which is a problem if your content breaks into multiple lines,
.
Is there a way to prevent this from happening or should I modify my code and put everything in a single line in order to avoid this problem?
html css safari
html css safari
edited Nov 14 '18 at 17:25
mplungjan
88.4k21125182
88.4k21125182
asked Nov 14 '18 at 17:22
Daniel PachecoDaniel Pacheco
1
1
It sounds very IE6 to have whitespace render. It used to happen with images. If you have text-decoration:underline do you actually get a _Some neat content_ underline before and after? I would personally always try to be defensive and not have leading and trailing whitespace in a link because I had such issue before
– mplungjan
Nov 14 '18 at 17:27
@mplungjan It's weird. When using "text-decoration: underline" it renders the first space but not the last. It seems to ignore the last one, but fails to do the same with the one at the beginning.
– Daniel Pacheco
Nov 14 '18 at 22:51
add a comment |
It sounds very IE6 to have whitespace render. It used to happen with images. If you have text-decoration:underline do you actually get a _Some neat content_ underline before and after? I would personally always try to be defensive and not have leading and trailing whitespace in a link because I had such issue before
– mplungjan
Nov 14 '18 at 17:27
@mplungjan It's weird. When using "text-decoration: underline" it renders the first space but not the last. It seems to ignore the last one, but fails to do the same with the one at the beginning.
– Daniel Pacheco
Nov 14 '18 at 22:51
It sounds very IE6 to have whitespace render. It used to happen with images. If you have text-decoration:underline do you actually get a _Some neat content_ underline before and after? I would personally always try to be defensive and not have leading and trailing whitespace in a link because I had such issue before
– mplungjan
Nov 14 '18 at 17:27
It sounds very IE6 to have whitespace render. It used to happen with images. If you have text-decoration:underline do you actually get a _Some neat content_ underline before and after? I would personally always try to be defensive and not have leading and trailing whitespace in a link because I had such issue before
– mplungjan
Nov 14 '18 at 17:27
@mplungjan It's weird. When using "text-decoration: underline" it renders the first space but not the last. It seems to ignore the last one, but fails to do the same with the one at the beginning.
– Daniel Pacheco
Nov 14 '18 at 22:51
@mplungjan It's weird. When using "text-decoration: underline" it renders the first space but not the last. It seems to ignore the last one, but fails to do the same with the one at the beginning.
– Daniel Pacheco
Nov 14 '18 at 22:51
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305647%2fhow-to-remove-first-and-last-space-from-text-node-using-safari%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
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
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53305647%2fhow-to-remove-first-and-last-space-from-text-node-using-safari%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
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
Required, but never shown
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
Required, but never shown
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
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
It sounds very IE6 to have whitespace render. It used to happen with images. If you have text-decoration:underline do you actually get a _Some neat content_ underline before and after? I would personally always try to be defensive and not have leading and trailing whitespace in a link because I had such issue before
– mplungjan
Nov 14 '18 at 17:27
@mplungjan It's weird. When using "text-decoration: underline" it renders the first space but not the last. It seems to ignore the last one, but fails to do the same with the one at the beginning.
– Daniel Pacheco
Nov 14 '18 at 22:51