I have a small script that generates, based on the day, the days left to an specific event, this is an example
<!-if looking for tommorrow then I have to create a div->
<div>1</div><!-the number 1 represents 1 day left to the event->
<!-if looking for tten days from now then I have to create 2 divs->
<div>1</div><div>0</div><!-the number 1 and 0 represent 10 days left to the event->
and so on, if 100 days left then 3 divs will be created, well they could be a div a p an h3 or any other text containing tag, the reson I am separating them by each character is because I am styling them to have a border around each number so it could well be 1, 2, 10, 100, 1000 days left or any other amount of days so my question is how can I align this elements to have around 5px in between and at the same time center them inside the container, the container is 180px wide, I can do it if I knew how many divs will be created, but in my situation it could be any amount of divs from 1 to no more than 4 or 5 but they are created dinamically
use an inline-level container like span or set display:inline;
set text-align:center;
add padding.
though I think I’d have to see a larger data set and an actual render of what you are trying to accomplish. Honestly just dumping out numbers blindly like that without any sort of semantics sounds REALLY bad – but not knowing what the data is actually for I’m just guessing wildly while blindfolded.
I used a p element as the container because I guessed that you were saying something like “100 days left…”. The p could be changed for a div or other more suitable tag if the context is not as I guessed.