Note that there are some explanatory texts on larger screens.

plurals
  1. POissue with text-allign in javascript
    primarykey
    data
    text
    <p>I want to build a legend in the following format: with minvalue, separated, maxvalue</p> <p>For example - </p> <blockquote> <p>10-20</p> <p>20-30</p> <p>30-40</p> </blockquote> <p>The problems are :</p> <p>1.I don't succeed to align the text. I want that the min value will be at the right place the separated will be at center and the max value will be at left.</p> <p>2. I need that the the number will be allign for example</p> <pre><code> 0 - 20 10000 - 3000 20000 - 40000 30000 - 500000 var legendWrapper = $('&lt;div /&gt;'); legendWrapper.addClass('legendWrapper') parentElement.appendChild(legendWrapper.get(0)); legend.addClass('legend') for (var index = 0; index &lt; self.legendData.getSubElementLength(); index++) { var legendItem = $('&lt;div /&gt;'); legendItem.addClass('legendItem') if (index == self.legendData.getSubElementLength() - 1) legendItem.addClass('lastLegendItem'); var color = $('&lt;span /&gt;'); color.addClass('legendColor') legendItem.get(0).appendChild(color.get(0)); var minValue = $('&lt;span /&gt;'); minValue.addClass('minValue') legendItem.get(0).appendChild(minValue.get(0)); var separated = $('&lt;span /&gt;'); separated.addClass('separated'); legendItem.get(0).appendChild(separated.get(0)); var maxValue = $('&lt;span /&gt;'); maxValue.addClass('maxValue') legendItem.get(0).appendChild(maxValue.get(0)); legend.get(0).appendChild(legendItem.get(0)); } $('.legendWrapper').get(0).appendChild(legend.get(0)); </code></pre> <p>The CSS:</p> <pre><code>.legendWrapper { } .separated { text-align: center; } .minValue { text-align: left; } .maxValue { text-align: right; } .legend { background-color: black; position: fixed; opacity: 0.7; margin: 10px; padding: 5px; width: 150px; height: 100px; clear: both; right: 80px; top: 800px; } .legendColor { height: 12px; width: 12px; margin-right: 3px; float: left; color: white; opacity: 1; } .legendItem { color :white; height: 20px; opacity: 1; } </code></pre> <p>When I added text-align to the <code>legendItem</code> it aligns the text but it aligns all of the span and I want to align span by span.</p> <p>Could you please advise me on how to fix this issue?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload