JavaScript Align clocks horizontally on a webpage css align blocks horizontally,align div blocks horizontally

I want clocks displaying different time zones on a webpage that i am designing.For this,i have embedded the javascript files from a webiste called qlock.The HTML code is as follows:

<script type="text/javascript">
qlock_city_name="Adelaide";
qlock_gmt_offset=9.5;
qlock_bg_color="#000000";
qlock_text_color="#ffffff";
qlock_dst_week1=1;
qlock_dst_dow1=7;
qlock_dst_month1=10;
qlock_dst_week2=1;
qlock_dst_dow2=7;
qlock_dst_month2=4;
</script>
<script type="text/javascript" src="http://www.qlock.com/live/qlock.js"></script>

<script type="text/javascript"><!--
qlock_city_name="Melbourne";
qlock_gmt_offset=10;
qlock_bg_color="#000000";
qlock_text_color="#ffffff";
qlock_dst_week1=1;
qlock_dst_dow1=7;
qlock_dst_month1=10;
qlock_dst_week2=1;
qlock_dst_dow2=7;
qlock_dst_month2=4;
//--></script>
<script type="text/javascript" src="http://www.qlock.com/live/qlock.js"></script>

What this does is display the clocks of Adelaide and Melbourne one below the other. Is there any way to display them horizontally right next to each other?

Answer:1

Check this Fiddle

Wrap the clock with div and give the float to it

<div class="left"><script type="text/javascript">
qlock_city_name="Adelaide";
qlock_gmt_offset=9.5;
qlock_bg_color="#000000";
qlock_text_color="#ffffff";
qlock_dst_week1=1;
qlock_dst_dow1=7;
qlock_dst_month1=10;
qlock_dst_week2=1;
qlock_dst_dow2=7;
qlock_dst_month2=4;
</script>
<script type="text/javascript" src="http://www.qlock.com/live/qlock.js"></script>
    </div>
<div class="left">
<script type="text/javascript"><!--
qlock_city_name="Melbourne";
qlock_gmt_offset=10;
qlock_bg_color="#000000";
qlock_text_color="#ffffff";
qlock_dst_week1=1;
qlock_dst_dow1=7;
qlock_dst_month1=10;
qlock_dst_week2=1;
qlock_dst_dow2=7;
qlock_dst_month2=4;
//--></script>
<script type="text/javascript" src="http://www.qlock.com/live/qlock.js"></script>
    </div>

CSS

.left {
    float:left;
}
Answer:2

you could set a css property on your clocks to float left

#qlock1, #qlock2{
    float: left;
}

demo here

P.S. you could set a common class for all clocks and not worry about every id in your css

Answer:3

Looking at these articles from Mozilla's JavaScript guide: Expressions Statements expressions are also considered assignment statements. In fact, in the second article one can read "any expression ...

Looking at these articles from Mozilla's JavaScript guide: Expressions Statements expressions are also considered assignment statements. In fact, in the second article one can read "any expression ...

We are developing a PhoneGap app. We have 3 cases like this: $("#dvData .quantity input").on('keyup', function() { var totalamount = 0; var discountAmount = 0; var LineAmount1 = 0; ...

We are developing a PhoneGap app. We have 3 cases like this: $("#dvData .quantity input").on('keyup', function() { var totalamount = 0; var discountAmount = 0; var LineAmount1 = 0; ...

I want to know if it is possible to use ng-repeat in a model that look like this: Example Model: $scope.items = { item1:{[1,2,3,4,5]}, item2:{[a,b,c,d,e]}, item3:{[a1,b2,c3,d4,e5]} }; The ...

I want to know if it is possible to use ng-repeat in a model that look like this: Example Model: $scope.items = { item1:{[1,2,3,4,5]}, item2:{[a,b,c,d,e]}, item3:{[a1,b2,c3,d4,e5]} }; The ...

I am trying to create textboxes inside <div id="screens"> </div>. I have a drop down menu for which I select the number of textboxes to be created. The JavaScript code I've written here ...

I am trying to create textboxes inside <div id="screens"> </div>. I have a drop down menu for which I select the number of textboxes to be created. The JavaScript code I've written here ...

  1. create text field dynamically javascript
  2. create text file dynamically in c#
  3. create text box dynamically in asp.net
  4. unity create text dynamically
  5. create text file dynamically in ssis
  6. create text file dynamically in java
  7. create static text dynamically mfc
  8. create text field dynamically
  9. create textbox dynamically in c#
  10. dynamically create text file in php
  11. jquery create input text dynamically
  12. javascript create input text dynamically
  13. dynamically create text boxes asp.net c#
  14. dynamically create text file javascript
  15. create kendo textbox dynamically
  16. dynamically create textbox in jquery