Search code examples
cssskype

css uri skype button


I need to put skype button image inside his div but i am not able to do this.. the only thing that i was able to do is to align the parent div near another div but the skype button image is outside the div.. here the skype code:

<script type="text/javascript" src="http://www.skypeassets.com/i/scom/js/skype-uri.js"></script>
<div id="SkypeButton_Call_italy-amo_1" style="border: solid black 1px; float: left; width: 100px; height: 32px;">
  <script type="text/javascript">
    Skype.ui({
      "name": "call",
      "element": "SkypeButton_Call_italy-amo_1",
      "participants": ["italy-amo"],
      "imageSize": 32
    });
  </script>
</div>

As you can see I used inline css to float the parent div near to another div and that's ok but the image is outside the parent div (id="SkypeButton_Call_italy-amo_1")..

I tried with css but nothing... I don't know why..


Solution

  • So, first thing you can do to make your code perform better is to move script parts -

    <script type="text/javascript" src="http://www.skypeassets.com/i/scom/js/skype-uri.js"></script>
    <script type="text/javascript">
        Skype.ui({
          "name": "call",
          "element": "SkypeButton_Call_italy-amo_1",
          "participants": ["italy-amo"],
          "imageSize": 32
        });
      </script>   
    

    down and insert it immediately before closing </body> tag. Make sure, that order of both scripts is correct.
    Then your markup will simply be:

    <div id="SkypeButton_Call_italy-amo_1" style="border: solid black 1px; float:left; height:32px;">
    </div>   
    

    so you can apply following css to adjust it:

    #SkypeButton_Call_italy-amo_1_paraElement {
        margin:0;
    }
    #SkypeButton_Call_italy-amo_1_paraElement img {
        margin:0 !important;
        vertical-align:middle !important;
    }   
    

    Here is a JSfiddle showing that - in the future use it to create working examples of your problem.

    EDIT:

    <!DOCTYPE html>
    <html>
        <head>
            <meta charset="utf-8">
            <script type="text/javascript" src="http://www.skypeassets.com/i/scom/js/skype-uri.js"></script>
            <style>
                #SkypeButton_Call_italy-amo_1_paraElement {
                    margin:0;
                }
                #SkypeButton_Call_italy-amo_1_paraElement img {
                    margin:0 !important;
                    vertical-align:middle !important;
                }
            </style>
        </head>
        <body>
            <div id="SkypeButton_Call_italy-amo_1" style="border: solid black 1px; float: left; width: 100px; height: 32px;"></div>
            <script type="text/javascript">
                Skype.ui({
                  "name": "call",
                  "element": "SkypeButton_Call_italy-amo_1",
                  "participants": ["italy-amo"],
                  "imageSize": 32
                });
            </script>
        </body>
    </html>