Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-06-2012, 03:36 AM   PM User | #1
clevedemo
New to the CF scene

 
Join Date: May 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
clevedemo is an unknown quantity at this point
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..
clevedemo is offline   Reply With Quote
Old 05-06-2012, 03:48 AM   PM User | #2
felgall
Master Coder

 
felgall's Avatar
 
Join Date: Sep 2005
Location: Sydney, Australia
Posts: 5,448
Thanks: 0
Thanked 496 Times in 488 Posts
felgall is a jewel in the roughfelgall is a jewel in the roughfelgall is a jewel in the rough
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/
felgall is offline   Reply With Quote
Users who have thanked felgall for this post:
clevedemo (05-07-2012)
Old 05-06-2012, 04:19 AM   PM User | #3
Caliburn
New Coder

 
Join Date: Jan 2012
Posts: 19
Thanks: 8
Thanked 0 Times in 0 Posts
Caliburn is an unknown quantity at this point
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.
Caliburn is offline   Reply With Quote
Old 05-06-2012, 04:55 AM   PM User | #4
clevedemo
New to the CF scene

 
Join Date: May 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
clevedemo is an unknown quantity at this point
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?
clevedemo is offline   Reply With Quote
Old 05-06-2012, 04:56 AM   PM User | #5
clevedemo
New to the CF scene

 
Join Date: May 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
clevedemo is an unknown quantity at this point
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?
clevedemo is offline   Reply With Quote
Old 05-07-2012, 06:18 PM   PM User | #6
clevedemo
New to the CF scene

 
Join Date: May 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
clevedemo is an unknown quantity at this point
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.
clevedemo is offline   Reply With Quote
Reply

Bookmarks

Tags
css, html, javascript, responsive

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:06 AM.


Advertisement
Log in to turn off these ads.