Sandaysoft

Support forum for Cumulus weather station software
It is currently Fri May 24, 2013 4:05 am
Please click here before posting. Help me to help you!
Useful Links: Cumulus FAQ • Enhancement requests • Wiki (documentation)
Please put your approximate location into your profile
Add your web site to the Cumulus user map
Vantage Pro2 users with firmware 3.00 should upgrade to fw 3.12 and Cumulus 1.9.4

All times are UTC




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: CSS text-align problem?
PostPosted: Sun Jul 29, 2012 5:58 pm 
Offline
User avatar

Joined: Sun Jul 03, 2011 6:23 pm
Posts: 324
Location: Eastleigh, Hampshire, UK
Weather Station: Davis VP2 - 24hr FARS
Operating System: Windows 7 - 64 bit
I have several weather forecasts on my site and I had been centering them on the page like this:

<center>
<?php
include("widgets/accuwidget.php");
?>
</center>

This however fails CSS3 so I moved it to the CSS like this,
on the page:

<div id="accuwidget">
<?php
include("widgets/accuwidget.php");
?>
</div><!-- accuwidget -->

and on the CSS:

#accuwidget {text-align:center;}

However this seems to be a bit hit and miss. It centers the forecast widget on this page but not on this page. :? They both centered before using <center></center>.

The CSS is the same for both except the div name:
#accuwidget {text-align:center;}
#metwidget {text-align:center;}

Any ideas why one behaves and one does not?

_________________
Duke

Nightingale Weather PHP
Eastleigh, Hampshire, UK


Top
 Profile  
 
 Post subject: Re: CSS text-align problem?
PostPosted: Mon Jul 30, 2012 11:11 am 
Offline
User avatar

Joined: Fri Jun 24, 2011 5:57 pm
Posts: 176
Location: USA
Weather Station: Davis Vantage Pro2
Operating System: Windows XP3
Try this is your css:

{
display: block;
margin-left: auto;
margin-right: auto }

Kerry

_________________
http://www.tobyspondweather.com
twitter: @tobyspond


Top
 Profile  
 
 Post subject: Re: CSS text-align problem?
PostPosted: Mon Jul 30, 2012 6:39 pm 
Offline
User avatar

Joined: Sun Jul 03, 2011 6:23 pm
Posts: 324
Location: Eastleigh, Hampshire, UK
Weather Station: Davis VP2 - 24hr FARS
Operating System: Windows 7 - 64 bit
Thanks Kerry for your suggestion but that did not work either.

After banging my head for most of this evening :bash: , I've simply gone with this:

#accuwidget {text-align:center; padding-left:87px}

Anything wrong with that?

_________________
Duke

Nightingale Weather PHP
Eastleigh, Hampshire, UK


Top
 Profile  
 
 Post subject: Re: CSS text-align problem?
PostPosted: Mon Jul 30, 2012 7:50 pm 
Offline
User avatar

Joined: Fri Jun 24, 2011 5:57 pm
Posts: 176
Location: USA
Weather Station: Davis Vantage Pro2
Operating System: Windows XP3
Duke,

Another approach is to use positioning; e.g.,

{
position: absolute;
top: 2%;
left: 0.5%;
}

set the top and left percent to the value that gives you the position you want.

In the accuweather widget you specify a height and width in a div style - maybe that is causing the placement difficulty.

Kerry

_________________
http://www.tobyspondweather.com
twitter: @tobyspond


Top
 Profile  
 
 Post subject: Re: CSS text-align problem?
PostPosted: Mon Jul 30, 2012 8:10 pm 
Offline
User avatar

Joined: Sun Jul 03, 2011 6:23 pm
Posts: 324
Location: Eastleigh, Hampshire, UK
Weather Station: Davis VP2 - 24hr FARS
Operating System: Windows 7 - 64 bit
Quote:
In the accuweather widget you specify a height and width in a div style - maybe that is causing the placement difficulty.


Would it be better written as:

.style {text-align:center;}

_________________
Duke

Nightingale Weather PHP
Eastleigh, Hampshire, UK


Top
 Profile  
 
 Post subject: Re: CSS text-align problem?
PostPosted: Mon Jul 30, 2012 8:14 pm 
Offline
User avatar

Joined: Fri Jun 24, 2011 5:57 pm
Posts: 176
Location: USA
Weather Station: Davis Vantage Pro2
Operating System: Windows XP3
You can try that.

I tested the widget out on a page and was able to position it using

position: absolute;
top: 50%;
left: 10%;

in the css for the div id accuwidget

you may need to adjust the percentages.

Kerry

_________________
http://www.tobyspondweather.com
twitter: @tobyspond


Top
 Profile  
 
 Post subject: Re: CSS text-align problem?
PostPosted: Tue Jul 31, 2012 6:28 pm 
Offline
User avatar

Joined: Sun Jul 03, 2011 6:23 pm
Posts: 324
Location: Eastleigh, Hampshire, UK
Weather Station: Davis VP2 - 24hr FARS
Operating System: Windows 7 - 64 bit
Thanks for your efforts Kerry, but when I try that in the CSS the page background shrinks to about 100px height under the Accuweather widget. I'll just stick with the padding-left:87px; and not lose any sleep over it. It must be something with the widget why it will not obey text-align:center;.

Thanks for your help.

_________________
Duke

Nightingale Weather PHP
Eastleigh, Hampshire, UK


Top
 Profile  
 
 Post subject: Re: CSS text-align problem?
PostPosted: Wed Aug 01, 2012 12:49 am 
Offline
User avatar

Joined: Tue Dec 09, 2008 1:37 pm
Posts: 1851
Location: Dudley, West Midlands, UK
Weather Station: None !
Operating System: XP SP3
Code:
#accuwidget {width:630px; margin-left:auto; margin-right:auto;}

_________________
Image
......................Imagine, what you will KNOW tomorrow !


Top
 Profile  
 
 Post subject: Re: CSS text-align problem?
PostPosted: Wed Aug 01, 2012 5:54 pm 
Offline
User avatar

Joined: Sun Jul 03, 2011 6:23 pm
Posts: 324
Location: Eastleigh, Hampshire, UK
Weather Station: Davis VP2 - 24hr FARS
Operating System: Windows 7 - 64 bit
beteljuice wrote:
Code:
#accuwidget {width:630px; margin-left:auto; margin-right:auto;}


Thank you :)

_________________
Duke

Nightingale Weather PHP
Eastleigh, Hampshire, UK


Top
 Profile  
 
 Post subject: Re: CSS text-align problem?
PostPosted: Thu Aug 02, 2012 12:22 am 
Offline

Joined: Mon Aug 10, 2009 10:16 pm
Posts: 1772
Location: World...
Weather Station: No weather station
Operating System: No operating system
beteljuice wrote:
Code:
#accuwidget {width:630px; margin-left:auto; margin-right:auto;}
beteljuice, thank you for the suggested code - it seems this is mostly recommended CSS3 property as a (direct) replacement for the now deprecated 'align="center"' HTML attribute.

The only observation - if the code (CSS attributes) is used with a <div> tag, one must remember that, by default, the width of a <div> tag is 100%, thus a width value might be needed (as you have included into the code segment).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group