Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.4.2 (build 4085) - 12 March 2025

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

If you are posting a new Topic about an error or if you need help PLEASE read this first viewtopic.php?p=164080#p164080

CSS text-align problem?

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

Post Reply
duke

CSS text-align problem?

Post by duke »

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?
tobyspond
Posts: 252
Joined: Fri 24 Jun 2011 5:57 pm
Weather Station: Davis Vantage Pro2
Operating System: Windows 10
Location: Lamoine, Maine, USA

Re: CSS text-align problem?

Post by tobyspond »

Try this is your css:

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

Kerry
duke

Re: CSS text-align problem?

Post by duke »

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?
tobyspond
Posts: 252
Joined: Fri 24 Jun 2011 5:57 pm
Weather Station: Davis Vantage Pro2
Operating System: Windows 10
Location: Lamoine, Maine, USA

Re: CSS text-align problem?

Post by tobyspond »

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
duke

Re: CSS text-align problem?

Post by duke »

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;}
tobyspond
Posts: 252
Joined: Fri 24 Jun 2011 5:57 pm
Weather Station: Davis Vantage Pro2
Operating System: Windows 10
Location: Lamoine, Maine, USA

Re: CSS text-align problem?

Post by tobyspond »

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
duke

Re: CSS text-align problem?

Post by duke »

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.
User avatar
beteljuice
Posts: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
Location: Dudley, West Midlands, UK

Re: CSS text-align problem?

Post by beteljuice »

Code: Select all

#accuwidget {width:630px; margin-left:auto; margin-right:auto;}
Image
......................Imagine, what you will KNOW tomorrow !
duke

Re: CSS text-align problem?

Post by duke »

beteljuice wrote:

Code: Select all

#accuwidget {width:630px; margin-left:auto; margin-right:auto;}
Thank you :)
Post Reply