How do I?

Discussion in 'HTML & Website Design' started by quatto, Nov 30, 2010.

  1. #1
    center this?

    <script src="http://www.bluehost.com/src/js/CODE15/488x160/bh_488x160_01.gif" type="text/javascript"></script>

    or pad it to the left a bit?
     
    quatto, Nov 30, 2010 IP
  2. workingsmart

    workingsmart Well-Known Member

    Messages:
    411
    Likes Received:
    12
    Best Answers:
    9
    Trophy Points:
    120
    #2
    use some CSS and an html tag like this ==>

    
    <div class="bluehostad">
    <script src="http://www.bluehost.com/src/js/CODE15/488x160/bh_488x160_01.gif" type="text/javascript"></script>
    </div>
    
    Code (markup):
    Style it like so...
    
    .bluehostad {
    width: 468px;
    height: 160px;
    margin: 0px auto;
    padding: 0px;
    display: block;
    }
    
    Code (markup):
    Cheers!~
     
    workingsmart, Nov 30, 2010 IP
  3. quatto

    quatto Peon

    Messages:
    196
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks, but I just want to embed that in a post in wordpress...should I still do the above?
     
    quatto, Nov 30, 2010 IP
  4. workingsmart

    workingsmart Well-Known Member

    Messages:
    411
    Likes Received:
    12
    Best Answers:
    9
    Trophy Points:
    120
    #4
    If you want add to a wordpress post ==> in code view when creating the post add this:
    
    <div style="width: 468px;height: 160px;margin: 0px auto;padding: 0px;display: block;">
    <script src="http://www.bluehost.com/src/js/CODE15/488x160/bh_488x160_01.gif" type="text/javascript"></script>
    </div>
    
    Code (markup):
    Cheers!~
     
    workingsmart, Nov 30, 2010 IP
  5. quatto

    quatto Peon

    Messages:
    196
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    What about padding to the left or right? centering as well?
     
    quatto, Dec 1, 2010 IP
  6. workingsmart

    workingsmart Well-Known Member

    Messages:
    411
    Likes Received:
    12
    Best Answers:
    9
    Trophy Points:
    120
    #6
    margin: 0px auto; will center... do not use <center> tags... You can pad it if you want but since you know the dimensions you are better off with margin.
     
    workingsmart, Dec 1, 2010 IP
  7. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #7
    Also remember when you mention "margin:0 auto" to an element make sure you have a "width:XXXpx" mentioned to the element, else margin:0 auto will not work.

    example:
    
    #div1{
    margin: 0 auto;
    width: 960px;
    }
    
    Code (markup):
     
    radiant_luv, Dec 1, 2010 IP
  8. espmartin

    espmartin Well-Known Member

    Messages:
    1,137
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    160
    #8
    And you can omit the "display: block" attribute, as a DIV is a block-level element. Great advice WorkingSmart and Radiant_Luv!
     
    espmartin, Dec 1, 2010 IP
  9. jimanhk

    jimanhk Peon

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Won't a simple <center><script src="http://www.bluehost.com/src/js/CODE15/488x160/bh_488x160_01.gif" type="text/javascript"></script>
    </center> do the job?
     
    jimanhk, Dec 2, 2010 IP
  10. radiant_luv

    radiant_luv Peon

    Messages:
    1,327
    Likes Received:
    34
    Best Answers:
    1
    Trophy Points:
    0
    #10
    <CENTER> is deprecated and not recommandate to use.
     
    radiant_luv, Dec 2, 2010 IP
  11. workingsmart

    workingsmart Well-Known Member

    Messages:
    411
    Likes Received:
    12
    Best Answers:
    9
    Trophy Points:
    120
    #11
    That is absolutely true about the div being a block element, however in some wordpress themes ( especially with noobs ) I have found that certain existing CSS for these themes tend to overwrite the elements natural state and therefore, albeit redundant, have them re-add the block to the element as a "just in case"...

    Cheers!~
     
    workingsmart, Dec 4, 2010 IP
  12. espmartin

    espmartin Well-Known Member

    Messages:
    1,137
    Likes Received:
    46
    Best Answers:
    0
    Trophy Points:
    160
    #12
    Good advice to the noob. I would still stick to the Standard however, and add that declaration on a case-by-case basis - if the layout does seem wacked because of overwritten states :)

    Web Standards rock lol.

    Best Regards!
     
    espmartin, Dec 4, 2010 IP
  13. workingsmart

    workingsmart Well-Known Member

    Messages:
    411
    Likes Received:
    12
    Best Answers:
    9
    Trophy Points:
    120
    #13
    @espmartin

    100% agreed..... & You are right, Web Standards do rock!... :)

    Cheers!~
     
    workingsmart, Dec 4, 2010 IP