Making arrow at end of line stay attached to last word in line
I've tried everything I can think of to make the arrow, at the end of a line, remain attached to the last word and not wrapped to the next line, as columns get narrow, in a responsive environment. I've tried the 'arrow' span both inside and outside the trailing 'a' tag.
<h3 class="title-head"><a href="'link'">Link Text<span class="arrow">►</span></a></h3>
or
<h3 class="title-head"><a href="'link'">Link Text</a><span class="arrow">►</span></h3>
By the way, removing 'display:inline-block' on the 'arrow' does solve the wrap problem, but it creates some others, so I can't use that solution.
SOLUTION from @Temani Afif: This CSS works nicely with the arrow span outside the a tag (second example above):
.title-box h3.title-head a {
margin-right:1em;
}
.title-box h3.title-head .arrow {
color:#f7941d;
font-size:80%;
-webkit-transform:scale(.5,1);
transform:scale(.5,1);
display:inline-block;
position:relative;
bottom:0;
font-family:Arial, sans-serif;
margin-left:-1.2em;
}
html css
add a comment |
I've tried everything I can think of to make the arrow, at the end of a line, remain attached to the last word and not wrapped to the next line, as columns get narrow, in a responsive environment. I've tried the 'arrow' span both inside and outside the trailing 'a' tag.
<h3 class="title-head"><a href="'link'">Link Text<span class="arrow">►</span></a></h3>
or
<h3 class="title-head"><a href="'link'">Link Text</a><span class="arrow">►</span></h3>
By the way, removing 'display:inline-block' on the 'arrow' does solve the wrap problem, but it creates some others, so I can't use that solution.
SOLUTION from @Temani Afif: This CSS works nicely with the arrow span outside the a tag (second example above):
.title-box h3.title-head a {
margin-right:1em;
}
.title-box h3.title-head .arrow {
color:#f7941d;
font-size:80%;
-webkit-transform:scale(.5,1);
transform:scale(.5,1);
display:inline-block;
position:relative;
bottom:0;
font-family:Arial, sans-serif;
margin-left:-1.2em;
}
html css
Please show a proper Minimal, Complete, and Verifiable example. Right now I am having trouble even reproducing what you say happens, when I just copy&paste what you have shown into a jsfiddle and then change the viewport width, the arrow never breaks onto a new line on its own.
– misorude
Nov 20 '18 at 14:46
Please also post your CSS (especially the part withdisplay:inline-block
since you already mention it in the question). This makes it way easier for others to reproduce.
– elveti
Nov 20 '18 at 14:50
you may try to usewhite-space: nowrap;
– enxaneta
Nov 20 '18 at 15:00
add a comment |
I've tried everything I can think of to make the arrow, at the end of a line, remain attached to the last word and not wrapped to the next line, as columns get narrow, in a responsive environment. I've tried the 'arrow' span both inside and outside the trailing 'a' tag.
<h3 class="title-head"><a href="'link'">Link Text<span class="arrow">►</span></a></h3>
or
<h3 class="title-head"><a href="'link'">Link Text</a><span class="arrow">►</span></h3>
By the way, removing 'display:inline-block' on the 'arrow' does solve the wrap problem, but it creates some others, so I can't use that solution.
SOLUTION from @Temani Afif: This CSS works nicely with the arrow span outside the a tag (second example above):
.title-box h3.title-head a {
margin-right:1em;
}
.title-box h3.title-head .arrow {
color:#f7941d;
font-size:80%;
-webkit-transform:scale(.5,1);
transform:scale(.5,1);
display:inline-block;
position:relative;
bottom:0;
font-family:Arial, sans-serif;
margin-left:-1.2em;
}
html css
I've tried everything I can think of to make the arrow, at the end of a line, remain attached to the last word and not wrapped to the next line, as columns get narrow, in a responsive environment. I've tried the 'arrow' span both inside and outside the trailing 'a' tag.
<h3 class="title-head"><a href="'link'">Link Text<span class="arrow">►</span></a></h3>
or
<h3 class="title-head"><a href="'link'">Link Text</a><span class="arrow">►</span></h3>
By the way, removing 'display:inline-block' on the 'arrow' does solve the wrap problem, but it creates some others, so I can't use that solution.
SOLUTION from @Temani Afif: This CSS works nicely with the arrow span outside the a tag (second example above):
.title-box h3.title-head a {
margin-right:1em;
}
.title-box h3.title-head .arrow {
color:#f7941d;
font-size:80%;
-webkit-transform:scale(.5,1);
transform:scale(.5,1);
display:inline-block;
position:relative;
bottom:0;
font-family:Arial, sans-serif;
margin-left:-1.2em;
}
html css
html css
edited Nov 20 '18 at 15:11
Ray
asked Nov 20 '18 at 14:37
RayRay
1136
1136
Please show a proper Minimal, Complete, and Verifiable example. Right now I am having trouble even reproducing what you say happens, when I just copy&paste what you have shown into a jsfiddle and then change the viewport width, the arrow never breaks onto a new line on its own.
– misorude
Nov 20 '18 at 14:46
Please also post your CSS (especially the part withdisplay:inline-block
since you already mention it in the question). This makes it way easier for others to reproduce.
– elveti
Nov 20 '18 at 14:50
you may try to usewhite-space: nowrap;
– enxaneta
Nov 20 '18 at 15:00
add a comment |
Please show a proper Minimal, Complete, and Verifiable example. Right now I am having trouble even reproducing what you say happens, when I just copy&paste what you have shown into a jsfiddle and then change the viewport width, the arrow never breaks onto a new line on its own.
– misorude
Nov 20 '18 at 14:46
Please also post your CSS (especially the part withdisplay:inline-block
since you already mention it in the question). This makes it way easier for others to reproduce.
– elveti
Nov 20 '18 at 14:50
you may try to usewhite-space: nowrap;
– enxaneta
Nov 20 '18 at 15:00
Please show a proper Minimal, Complete, and Verifiable example. Right now I am having trouble even reproducing what you say happens, when I just copy&paste what you have shown into a jsfiddle and then change the viewport width, the arrow never breaks onto a new line on its own.
– misorude
Nov 20 '18 at 14:46
Please show a proper Minimal, Complete, and Verifiable example. Right now I am having trouble even reproducing what you say happens, when I just copy&paste what you have shown into a jsfiddle and then change the viewport width, the arrow never breaks onto a new line on its own.
– misorude
Nov 20 '18 at 14:46
Please also post your CSS (especially the part with
display:inline-block
since you already mention it in the question). This makes it way easier for others to reproduce.– elveti
Nov 20 '18 at 14:50
Please also post your CSS (especially the part with
display:inline-block
since you already mention it in the question). This makes it way easier for others to reproduce.– elveti
Nov 20 '18 at 14:50
you may try to use
white-space: nowrap;
– enxaneta
Nov 20 '18 at 15:00
you may try to use
white-space: nowrap;
– enxaneta
Nov 20 '18 at 15:00
add a comment |
2 Answers
2
active
oldest
votes
Use a non-breakable space
h3 {
animation:change 2s linear infinite alternate;
border:1px solid;
}
@keyframes change {
from {max-width:50%}
to {max-width:10%}
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
With inline-block
you can try a margin hack like this:
h3 {
animation:change 2s linear infinite alternate;
border:1px solid;
margin-right:30px;
}
@keyframes change {
from {max-width:50%}
to {max-width:10%}
}
.arrow {
display:inline-block;
margin-right:-30px;
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
UPDATE
Considering your CSS code:
h3 {
animation: change 2s linear infinite alternate;
border: 1px solid;
margin-right: 20px;
}
@keyframes change {
from {
max-width: 50%
}
to {
max-width: 10%
}
}
h3.title-head .arrow {
color: #f7941d;
font-size: 80%;
-webkit-transform: scale(.5, 1);
transform: scale(.5, 1);
display: inline-block;
position: relative;
left: -.13em;
bottom: 0;
font-family: Arial, sans-serif;
margin-right: -20px;
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
Only works if not using 'display:inline-block' on the 'arrow' span.
– Ray
Nov 20 '18 at 14:53
@Ray check the update
– Temani Afif
Nov 20 '18 at 14:57
add a comment |
If I understood you correctly, you could try making the arrow absolutely positioned:
h3 {
position: relative;
padding-right: 15px;
}
h3 > span {
position: absolute;
top: 4px;
right: 0;
}
Demo: https://jsfiddle.net/pxqrh1cu/
Feel free to leave a comment if I misunderstood the problem.
Unfortunately, this doesn't attach the arrow to the last word.
– Ray
Nov 20 '18 at 14:49
add a comment |
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%2f53395373%2fmaking-arrow-at-end-of-line-stay-attached-to-last-word-in-line%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Use a non-breakable space
h3 {
animation:change 2s linear infinite alternate;
border:1px solid;
}
@keyframes change {
from {max-width:50%}
to {max-width:10%}
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
With inline-block
you can try a margin hack like this:
h3 {
animation:change 2s linear infinite alternate;
border:1px solid;
margin-right:30px;
}
@keyframes change {
from {max-width:50%}
to {max-width:10%}
}
.arrow {
display:inline-block;
margin-right:-30px;
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
UPDATE
Considering your CSS code:
h3 {
animation: change 2s linear infinite alternate;
border: 1px solid;
margin-right: 20px;
}
@keyframes change {
from {
max-width: 50%
}
to {
max-width: 10%
}
}
h3.title-head .arrow {
color: #f7941d;
font-size: 80%;
-webkit-transform: scale(.5, 1);
transform: scale(.5, 1);
display: inline-block;
position: relative;
left: -.13em;
bottom: 0;
font-family: Arial, sans-serif;
margin-right: -20px;
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
Only works if not using 'display:inline-block' on the 'arrow' span.
– Ray
Nov 20 '18 at 14:53
@Ray check the update
– Temani Afif
Nov 20 '18 at 14:57
add a comment |
Use a non-breakable space
h3 {
animation:change 2s linear infinite alternate;
border:1px solid;
}
@keyframes change {
from {max-width:50%}
to {max-width:10%}
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
With inline-block
you can try a margin hack like this:
h3 {
animation:change 2s linear infinite alternate;
border:1px solid;
margin-right:30px;
}
@keyframes change {
from {max-width:50%}
to {max-width:10%}
}
.arrow {
display:inline-block;
margin-right:-30px;
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
UPDATE
Considering your CSS code:
h3 {
animation: change 2s linear infinite alternate;
border: 1px solid;
margin-right: 20px;
}
@keyframes change {
from {
max-width: 50%
}
to {
max-width: 10%
}
}
h3.title-head .arrow {
color: #f7941d;
font-size: 80%;
-webkit-transform: scale(.5, 1);
transform: scale(.5, 1);
display: inline-block;
position: relative;
left: -.13em;
bottom: 0;
font-family: Arial, sans-serif;
margin-right: -20px;
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
Only works if not using 'display:inline-block' on the 'arrow' span.
– Ray
Nov 20 '18 at 14:53
@Ray check the update
– Temani Afif
Nov 20 '18 at 14:57
add a comment |
Use a non-breakable space
h3 {
animation:change 2s linear infinite alternate;
border:1px solid;
}
@keyframes change {
from {max-width:50%}
to {max-width:10%}
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
With inline-block
you can try a margin hack like this:
h3 {
animation:change 2s linear infinite alternate;
border:1px solid;
margin-right:30px;
}
@keyframes change {
from {max-width:50%}
to {max-width:10%}
}
.arrow {
display:inline-block;
margin-right:-30px;
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
UPDATE
Considering your CSS code:
h3 {
animation: change 2s linear infinite alternate;
border: 1px solid;
margin-right: 20px;
}
@keyframes change {
from {
max-width: 50%
}
to {
max-width: 10%
}
}
h3.title-head .arrow {
color: #f7941d;
font-size: 80%;
-webkit-transform: scale(.5, 1);
transform: scale(.5, 1);
display: inline-block;
position: relative;
left: -.13em;
bottom: 0;
font-family: Arial, sans-serif;
margin-right: -20px;
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
Use a non-breakable space
h3 {
animation:change 2s linear infinite alternate;
border:1px solid;
}
@keyframes change {
from {max-width:50%}
to {max-width:10%}
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
With inline-block
you can try a margin hack like this:
h3 {
animation:change 2s linear infinite alternate;
border:1px solid;
margin-right:30px;
}
@keyframes change {
from {max-width:50%}
to {max-width:10%}
}
.arrow {
display:inline-block;
margin-right:-30px;
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
UPDATE
Considering your CSS code:
h3 {
animation: change 2s linear infinite alternate;
border: 1px solid;
margin-right: 20px;
}
@keyframes change {
from {
max-width: 50%
}
to {
max-width: 10%
}
}
h3.title-head .arrow {
color: #f7941d;
font-size: 80%;
-webkit-transform: scale(.5, 1);
transform: scale(.5, 1);
display: inline-block;
position: relative;
left: -.13em;
bottom: 0;
font-family: Arial, sans-serif;
margin-right: -20px;
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
h3 {
animation:change 2s linear infinite alternate;
border:1px solid;
}
@keyframes change {
from {max-width:50%}
to {max-width:10%}
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
h3 {
animation:change 2s linear infinite alternate;
border:1px solid;
}
@keyframes change {
from {max-width:50%}
to {max-width:10%}
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
h3 {
animation:change 2s linear infinite alternate;
border:1px solid;
margin-right:30px;
}
@keyframes change {
from {max-width:50%}
to {max-width:10%}
}
.arrow {
display:inline-block;
margin-right:-30px;
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
h3 {
animation:change 2s linear infinite alternate;
border:1px solid;
margin-right:30px;
}
@keyframes change {
from {max-width:50%}
to {max-width:10%}
}
.arrow {
display:inline-block;
margin-right:-30px;
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
h3 {
animation: change 2s linear infinite alternate;
border: 1px solid;
margin-right: 20px;
}
@keyframes change {
from {
max-width: 50%
}
to {
max-width: 10%
}
}
h3.title-head .arrow {
color: #f7941d;
font-size: 80%;
-webkit-transform: scale(.5, 1);
transform: scale(.5, 1);
display: inline-block;
position: relative;
left: -.13em;
bottom: 0;
font-family: Arial, sans-serif;
margin-right: -20px;
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
h3 {
animation: change 2s linear infinite alternate;
border: 1px solid;
margin-right: 20px;
}
@keyframes change {
from {
max-width: 50%
}
to {
max-width: 10%
}
}
h3.title-head .arrow {
color: #f7941d;
font-size: 80%;
-webkit-transform: scale(.5, 1);
transform: scale(.5, 1);
display: inline-block;
position: relative;
left: -.13em;
bottom: 0;
font-family: Arial, sans-serif;
margin-right: -20px;
}
<h3 class="title-head"><a href="'link'">Link Text</a> <span class="arrow">►</span></h3>
edited Nov 20 '18 at 15:02
answered Nov 20 '18 at 14:48
Temani AfifTemani Afif
73.7k94184
73.7k94184
Only works if not using 'display:inline-block' on the 'arrow' span.
– Ray
Nov 20 '18 at 14:53
@Ray check the update
– Temani Afif
Nov 20 '18 at 14:57
add a comment |
Only works if not using 'display:inline-block' on the 'arrow' span.
– Ray
Nov 20 '18 at 14:53
@Ray check the update
– Temani Afif
Nov 20 '18 at 14:57
Only works if not using 'display:inline-block' on the 'arrow' span.
– Ray
Nov 20 '18 at 14:53
Only works if not using 'display:inline-block' on the 'arrow' span.
– Ray
Nov 20 '18 at 14:53
@Ray check the update
– Temani Afif
Nov 20 '18 at 14:57
@Ray check the update
– Temani Afif
Nov 20 '18 at 14:57
add a comment |
If I understood you correctly, you could try making the arrow absolutely positioned:
h3 {
position: relative;
padding-right: 15px;
}
h3 > span {
position: absolute;
top: 4px;
right: 0;
}
Demo: https://jsfiddle.net/pxqrh1cu/
Feel free to leave a comment if I misunderstood the problem.
Unfortunately, this doesn't attach the arrow to the last word.
– Ray
Nov 20 '18 at 14:49
add a comment |
If I understood you correctly, you could try making the arrow absolutely positioned:
h3 {
position: relative;
padding-right: 15px;
}
h3 > span {
position: absolute;
top: 4px;
right: 0;
}
Demo: https://jsfiddle.net/pxqrh1cu/
Feel free to leave a comment if I misunderstood the problem.
Unfortunately, this doesn't attach the arrow to the last word.
– Ray
Nov 20 '18 at 14:49
add a comment |
If I understood you correctly, you could try making the arrow absolutely positioned:
h3 {
position: relative;
padding-right: 15px;
}
h3 > span {
position: absolute;
top: 4px;
right: 0;
}
Demo: https://jsfiddle.net/pxqrh1cu/
Feel free to leave a comment if I misunderstood the problem.
If I understood you correctly, you could try making the arrow absolutely positioned:
h3 {
position: relative;
padding-right: 15px;
}
h3 > span {
position: absolute;
top: 4px;
right: 0;
}
Demo: https://jsfiddle.net/pxqrh1cu/
Feel free to leave a comment if I misunderstood the problem.
answered Nov 20 '18 at 14:44
elvetielveti
8202815
8202815
Unfortunately, this doesn't attach the arrow to the last word.
– Ray
Nov 20 '18 at 14:49
add a comment |
Unfortunately, this doesn't attach the arrow to the last word.
– Ray
Nov 20 '18 at 14:49
Unfortunately, this doesn't attach the arrow to the last word.
– Ray
Nov 20 '18 at 14:49
Unfortunately, this doesn't attach the arrow to the last word.
– Ray
Nov 20 '18 at 14:49
add a comment |
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%2f53395373%2fmaking-arrow-at-end-of-line-stay-attached-to-last-word-in-line%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
Please show a proper Minimal, Complete, and Verifiable example. Right now I am having trouble even reproducing what you say happens, when I just copy&paste what you have shown into a jsfiddle and then change the viewport width, the arrow never breaks onto a new line on its own.
– misorude
Nov 20 '18 at 14:46
Please also post your CSS (especially the part with
display:inline-block
since you already mention it in the question). This makes it way easier for others to reproduce.– elveti
Nov 20 '18 at 14:50
you may try to use
white-space: nowrap;
– enxaneta
Nov 20 '18 at 15:00