Question: In any programming language (like php, java, javascript etc) is it possible to dynamically create a changing number of variables in a loop, within a given name space?

for example, if I want to create N variables that have random numbers between 1 and 5, which are to be called random1, random2 .. randomN, is it possible to do something like:

```
loop ( N ){<br>
  create variable randomN = random(1,5);<br>
}

```

Answer: 
If you are willing to restructure your markup a little (without adding any additional size to it):

<http://jsfiddle.net/8kcQv/>

The key line is:

```
.icon:empty{ padding-left: 20px; }

```

This works in IE 9, Chrome, etc. Other browsers will add extra space between empty elements. Here's an alternate version which degrades differently (less space between icon and text) when `:empty` is not supported:

<http://jsfiddle.net/8kcQv/1/>

HTML
----

```
<div class="icon">This message has text.</div>
<br>
<br>
<div class="icon"></div><div class="icon"></div><div class="icon"></div><div class="icon"></div><div class="icon"></div>

```

CSS
---

```
.icon{
 padding: 4px 4px 4px 32px; /* 32px adds extra space to pad against text */
 height: 24px;
 line-height: 16px;
 font-family: sans-serif;
 font-size: 16px;
 background:url(http://icons.iconarchive.com/icons/pixelmixer/basic/16/warning-icon.png) no-repeat 4px 4px;
 display: inline-block;
}

/* empty matches elements with no children (including text nodes) */
.icon:empty{ padding-left: 20px; } 

```

Alternatively, you might be able to do without `:empty` altogether if you use a style like:

```
.icon{
    padding: 4px 8px 4px 24px;
    ...
}

```

This places equal distance on both sides of the icon.
I suggest using addClass jQuery. Add a certain class which will add a space if there is text after it, else don't put any class. You should set the default item with no space at all.