Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    May 2012
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Please help with minor code mod.

    Hi everyone, if you are reading this thank you for taking the time. I have a minor code riddle, that I know one of you code gurus out there will solve in seconds. My code is for a paypal logo stripe, right now its just some HTML with a little Java. It aligns the logo to the right. That is what I WANT for desktop computers. However my site is responsive, so when the screen reduces to a Phone size screen I would like to set the Logo to center.

    Heres my code that is working for Desktops:

    <table align="right" border="0" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td align="center">
    <a href="#" onclick="javascript:window.open('https://www.paypal.com/cgi-bin/webscr?cmd=xpt/Marketing/popup/OLCWhatIsPayPal-outside','olcwhatispaypal','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width=400, height=350');"><img alt="Solution Graphics" border="0" src="http://jlfiberoptic.com/image/horizontal_solution_PPeCheck.gif" /></a></td>
    </tr>
    </tbody>
    </table>

    I want if the screen size is 481px and below to <table align="center" (not "right")
    How can I do this with inline CSS, HTML or JavScript?

    Please help..

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    The align attribute in HTML has been obsolete since 1996. You should be setting the position from within the CSS - eg. float:right

    You can use media queries to apply different CSS based on the available width within the viewport.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • Users who have thanked felgall for this post:

    clevedemo (05-07-2012)

  • #3
    New Coder
    Join Date
    Jan 2012
    Posts
    19
    Thanks
    8
    Thanked 0 Times in 0 Posts
    All design aspects of your website should be handled through CSS. As felgall said - the align attribute has been obsolete since 1996. Also I would avoid using tables. That is another obsolete design method.

  • #4
    New to the CF scene
    Join Date
    May 2012
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by felgall View Post
    The align attribute in HTML has been obsolete since 1996. You should be setting the position from within the CSS - eg. float:right

    You can use media queries to apply different CSS based on the available width within the viewport.
    Thanks, I just picked up the code straight from paypal. I'm using OpenCart. They give me a window to add my code for the footer. I would have to use inline CSS. How would I write the Inline CSS?

  • #5
    New to the CF scene
    Join Date
    May 2012
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Caliburn View Post
    All design aspects of your website should be handled through CSS. As felgall said - the align attribute has been obsolete since 1996. Also I would avoid using tables. That is another obsolete design method.
    Thanks, I just picked up the code straight from paypal. I'm using OpenCart. They give me a window to add my code for the footer. I would have to use inline CSS. How would I write the Inline CSS?

    I don't know if I can reference external CSS. how could I fix the code?

  • #6
    New to the CF scene
    Join Date
    May 2012
    Posts
    4
    Thanks
    1
    Thanked 0 Times in 0 Posts
    All solved. By a brilliant coder with one simple change.

    From:
    <table align="right" border="0" cellpadding="0" cellspacing="0">

    To:
    <style=”margin: auto;” border="0" cellpadding="0" cellspacing="0">

    Wow.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •