Making arrow at end of line stay attached to last word in line












0















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;
}









share|improve this question

























  • 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
















0















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;
}









share|improve this question

























  • 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














0












0








0








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;
}









share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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



















  • 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

















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












2 Answers
2






active

oldest

votes


















3














Use a non-breakable space &nbsp;






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>&nbsp;<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>&nbsp;<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>&nbsp;<span class="arrow">►</span></h3>








share|improve this answer


























  • 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



















0














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.






share|improve this answer
























  • Unfortunately, this doesn't attach the arrow to the last word.

    – Ray
    Nov 20 '18 at 14:49











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
});


}
});














draft saved

draft discarded


















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









3














Use a non-breakable space &nbsp;






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>&nbsp;<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>&nbsp;<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>&nbsp;<span class="arrow">►</span></h3>








share|improve this answer


























  • 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
















3














Use a non-breakable space &nbsp;






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>&nbsp;<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>&nbsp;<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>&nbsp;<span class="arrow">►</span></h3>








share|improve this answer


























  • 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














3












3








3







Use a non-breakable space &nbsp;






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>&nbsp;<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>&nbsp;<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>&nbsp;<span class="arrow">►</span></h3>








share|improve this answer















Use a non-breakable space &nbsp;






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>&nbsp;<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>&nbsp;<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>&nbsp;<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>&nbsp;<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>&nbsp;<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>&nbsp;<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>&nbsp;<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>&nbsp;<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>&nbsp;<span class="arrow">►</span></h3>






share|improve this answer














share|improve this answer



share|improve this answer








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



















  • 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













0














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.






share|improve this answer
























  • Unfortunately, this doesn't attach the arrow to the last word.

    – Ray
    Nov 20 '18 at 14:49
















0














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.






share|improve this answer
























  • Unfortunately, this doesn't attach the arrow to the last word.

    – Ray
    Nov 20 '18 at 14:49














0












0








0







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.






share|improve this answer













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.







share|improve this answer












share|improve this answer



share|improve this answer










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



















  • 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


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

mysqli_query(): Empty query in /home/lucindabrummitt/public_html/blog/wp-includes/wp-db.php on line 1924

How to change which sound is reproduced for terminal bell?

Can I use Tabulator js library in my java Spring + Thymeleaf project?