PDA

View Full Version : show in line 3 JavaScripts' in one line



auriaks
Feb 28th, 2010, 08:41 PM
Hi,

I have 3 javascripts:



<script language=javascript src='http://www.120x60.lt/serve.php?12568,2,1'></script><a target=_blank href='http://www.120x60.lt/refer.php?12843'><font color='yellow'><b>120x60.lt</b></font></a>

<script language=javascript src='http://www.120x60.lt/serve.php?12568,2,1'></script><a target=_blank href='http://www.120x60.lt/refer.php?12843'><font color='yellow'><b>120x60.lt</b></font></a>

<script language=javascript src='http://www.120x60.lt/serve.php?12568,2,1'></script><a target=_blank href='http://www.120x60.lt/refer.php?12843'><font color='yellow'><b>120x60.lt</b></font></a>

I want to write them in one line, but they automatically gets <br/> and the output is in 3 lines. How this can be done via css??

mbaker
Mar 1st, 2010, 10:18 AM
The problem is (actually there are lots of problems, but I'll just deal with the first) that script is a block level element. Each script is displayed in its own block.

You can overcome this by setting up a CSS class, say "ads" to float:left; as in:


<style type="text/css">
div.ads {float:left; margin-right:1em;}
</style>

Then wrap each <script> and <a> in <div class="ads"></div> as in:


<div class="ads">
<script language=javascript src='http://www.120x60.lt/serve.php?12568,2,1'></script>
</div><div class="ads">
<a target=_blank href='http://www.120x60.lt/refer.php?12843'><font color='yellow'><b>120x60.lt</b></font></a>
</div><div class="ads">

<script language=javascript src='http://www.120x60.lt/serve.php?12568,2,1'></script>
</div><div class="ads">
<a target=_blank href='http://www.120x60.lt/refer.php?12843'><font color='yellow'><b>120x60.lt</b></font></a>
</div><div class="ads">

<script language=javascript src='http://www.120x60.lt/serve.php?12568,2,1'></script>
</div><div class="ads">
<a target=_blank href='http://www.120x60.lt/refer.php?12843'><font color='yellow'><b>120x60.lt</b></font></a>
</div>

You should probably also follow this by something that clears the floats like: <div style="clear:left"></div>

auriaks
Mar 2nd, 2010, 08:21 PM
thanks :)