How to right align some part of text in in











up vote
0
down vote

favorite












This is current look:



enter image description here



I expect this:



enter image description here



Code:



   <select class="form-control">
<option value="1123x1">SJ [1123]</option>
<option value="562x1">Rib / Int. [562]</option>
<option value="1123x3">Fleece [1123]</option>
</select>


Suggestion for select2 is also needed.










share|improve this question
























  • try it like this <option value="1123x1">SJ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [1123]</option>
    – pravin navle
    17 hours ago










  • I don't think it is possible only with css why don't you try dropdown list
    – Viira
    17 hours ago










  • Character length are not always same so alignment break :'(
    – Amin
    17 hours ago










  • how to do that? @Viira
    – Amin
    17 hours ago










  • possible duplicate of : stackoverflow.com/questions/50969850/…
    – Temani Afif
    17 hours ago















up vote
0
down vote

favorite












This is current look:



enter image description here



I expect this:



enter image description here



Code:



   <select class="form-control">
<option value="1123x1">SJ [1123]</option>
<option value="562x1">Rib / Int. [562]</option>
<option value="1123x3">Fleece [1123]</option>
</select>


Suggestion for select2 is also needed.










share|improve this question
























  • try it like this <option value="1123x1">SJ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [1123]</option>
    – pravin navle
    17 hours ago










  • I don't think it is possible only with css why don't you try dropdown list
    – Viira
    17 hours ago










  • Character length are not always same so alignment break :'(
    – Amin
    17 hours ago










  • how to do that? @Viira
    – Amin
    17 hours ago










  • possible duplicate of : stackoverflow.com/questions/50969850/…
    – Temani Afif
    17 hours ago













up vote
0
down vote

favorite









up vote
0
down vote

favorite











This is current look:



enter image description here



I expect this:



enter image description here



Code:



   <select class="form-control">
<option value="1123x1">SJ [1123]</option>
<option value="562x1">Rib / Int. [562]</option>
<option value="1123x3">Fleece [1123]</option>
</select>


Suggestion for select2 is also needed.










share|improve this question















This is current look:



enter image description here



I expect this:



enter image description here



Code:



   <select class="form-control">
<option value="1123x1">SJ [1123]</option>
<option value="562x1">Rib / Int. [562]</option>
<option value="1123x3">Fleece [1123]</option>
</select>


Suggestion for select2 is also needed.







html css jquery-select2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 17 hours ago









Alon Eitan

11.1k63652




11.1k63652










asked 17 hours ago









Amin

69111




69111












  • try it like this <option value="1123x1">SJ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [1123]</option>
    – pravin navle
    17 hours ago










  • I don't think it is possible only with css why don't you try dropdown list
    – Viira
    17 hours ago










  • Character length are not always same so alignment break :'(
    – Amin
    17 hours ago










  • how to do that? @Viira
    – Amin
    17 hours ago










  • possible duplicate of : stackoverflow.com/questions/50969850/…
    – Temani Afif
    17 hours ago


















  • try it like this <option value="1123x1">SJ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [1123]</option>
    – pravin navle
    17 hours ago










  • I don't think it is possible only with css why don't you try dropdown list
    – Viira
    17 hours ago










  • Character length are not always same so alignment break :'(
    – Amin
    17 hours ago










  • how to do that? @Viira
    – Amin
    17 hours ago










  • possible duplicate of : stackoverflow.com/questions/50969850/…
    – Temani Afif
    17 hours ago
















try it like this <option value="1123x1">SJ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [1123]</option>
– pravin navle
17 hours ago




try it like this <option value="1123x1">SJ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [1123]</option>
– pravin navle
17 hours ago












I don't think it is possible only with css why don't you try dropdown list
– Viira
17 hours ago




I don't think it is possible only with css why don't you try dropdown list
– Viira
17 hours ago












Character length are not always same so alignment break :'(
– Amin
17 hours ago




Character length are not always same so alignment break :'(
– Amin
17 hours ago












how to do that? @Viira
– Amin
17 hours ago




how to do that? @Viira
– Amin
17 hours ago












possible duplicate of : stackoverflow.com/questions/50969850/…
– Temani Afif
17 hours ago




possible duplicate of : stackoverflow.com/questions/50969850/…
– Temani Afif
17 hours ago












1 Answer
1






active

oldest

votes

















up vote
0
down vote













there must be some better solution. this is my attempt to address your problem






 <select class="form-control">
<option value="1123x1">SJ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[1123]</option>
<option value="562x1">Rib / Int.&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [562]</option>
<option value="1123x3">Fleece&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [1123]</option>
</select>








share|improve this answer





















  • It would make the list to look just like in the first screenshot the OP provided, would it not?
    – Alon Eitan
    17 hours ago










  • I am generating the <option>s from a PHP script, there may be hundreds of options
    – Amin
    17 hours ago












  • yes, but if the list is static then he can adjust the number of &nbsp; to get the desired result.
    – pravin navle
    17 hours ago










  • ok let me think of some workaround. this is quite tricky and a bit hard to achieve
    – pravin navle
    17 hours ago











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',
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%2f53237644%2fhow-to-right-align-some-part-of-text-in-option-in-select%23new-answer', 'question_page');
}
);

Post as a guest
































1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













there must be some better solution. this is my attempt to address your problem






 <select class="form-control">
<option value="1123x1">SJ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[1123]</option>
<option value="562x1">Rib / Int.&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [562]</option>
<option value="1123x3">Fleece&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [1123]</option>
</select>








share|improve this answer





















  • It would make the list to look just like in the first screenshot the OP provided, would it not?
    – Alon Eitan
    17 hours ago










  • I am generating the <option>s from a PHP script, there may be hundreds of options
    – Amin
    17 hours ago












  • yes, but if the list is static then he can adjust the number of &nbsp; to get the desired result.
    – pravin navle
    17 hours ago










  • ok let me think of some workaround. this is quite tricky and a bit hard to achieve
    – pravin navle
    17 hours ago















up vote
0
down vote













there must be some better solution. this is my attempt to address your problem






 <select class="form-control">
<option value="1123x1">SJ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[1123]</option>
<option value="562x1">Rib / Int.&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [562]</option>
<option value="1123x3">Fleece&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [1123]</option>
</select>








share|improve this answer





















  • It would make the list to look just like in the first screenshot the OP provided, would it not?
    – Alon Eitan
    17 hours ago










  • I am generating the <option>s from a PHP script, there may be hundreds of options
    – Amin
    17 hours ago












  • yes, but if the list is static then he can adjust the number of &nbsp; to get the desired result.
    – pravin navle
    17 hours ago










  • ok let me think of some workaround. this is quite tricky and a bit hard to achieve
    – pravin navle
    17 hours ago













up vote
0
down vote










up vote
0
down vote









there must be some better solution. this is my attempt to address your problem






 <select class="form-control">
<option value="1123x1">SJ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[1123]</option>
<option value="562x1">Rib / Int.&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [562]</option>
<option value="1123x3">Fleece&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [1123]</option>
</select>








share|improve this answer












there must be some better solution. this is my attempt to address your problem






 <select class="form-control">
<option value="1123x1">SJ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[1123]</option>
<option value="562x1">Rib / Int.&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [562]</option>
<option value="1123x3">Fleece&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [1123]</option>
</select>








 <select class="form-control">
<option value="1123x1">SJ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[1123]</option>
<option value="562x1">Rib / Int.&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [562]</option>
<option value="1123x3">Fleece&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [1123]</option>
</select>





 <select class="form-control">
<option value="1123x1">SJ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;[1123]</option>
<option value="562x1">Rib / Int.&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [562]</option>
<option value="1123x3">Fleece&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [1123]</option>
</select>






share|improve this answer












share|improve this answer



share|improve this answer










answered 17 hours ago









pravin navle

307116




307116












  • It would make the list to look just like in the first screenshot the OP provided, would it not?
    – Alon Eitan
    17 hours ago










  • I am generating the <option>s from a PHP script, there may be hundreds of options
    – Amin
    17 hours ago












  • yes, but if the list is static then he can adjust the number of &nbsp; to get the desired result.
    – pravin navle
    17 hours ago










  • ok let me think of some workaround. this is quite tricky and a bit hard to achieve
    – pravin navle
    17 hours ago


















  • It would make the list to look just like in the first screenshot the OP provided, would it not?
    – Alon Eitan
    17 hours ago










  • I am generating the <option>s from a PHP script, there may be hundreds of options
    – Amin
    17 hours ago












  • yes, but if the list is static then he can adjust the number of &nbsp; to get the desired result.
    – pravin navle
    17 hours ago










  • ok let me think of some workaround. this is quite tricky and a bit hard to achieve
    – pravin navle
    17 hours ago
















It would make the list to look just like in the first screenshot the OP provided, would it not?
– Alon Eitan
17 hours ago




It would make the list to look just like in the first screenshot the OP provided, would it not?
– Alon Eitan
17 hours ago












I am generating the <option>s from a PHP script, there may be hundreds of options
– Amin
17 hours ago






I am generating the <option>s from a PHP script, there may be hundreds of options
– Amin
17 hours ago














yes, but if the list is static then he can adjust the number of &nbsp; to get the desired result.
– pravin navle
17 hours ago




yes, but if the list is static then he can adjust the number of &nbsp; to get the desired result.
– pravin navle
17 hours ago












ok let me think of some workaround. this is quite tricky and a bit hard to achieve
– pravin navle
17 hours ago




ok let me think of some workaround. this is quite tricky and a bit hard to achieve
– pravin navle
17 hours ago


















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53237644%2fhow-to-right-align-some-part-of-text-in-option-in-select%23new-answer', 'question_page');
}
);

Post as a guest




















































































Popular posts from this blog

Bressuire

Vorschmack

Quarantine