Simple Machines Community Forum

General Community => Scripting Help => Topic started by: weerforum on September 18, 2012, 07:24:08 PM

Title: How to center
Post by: weerforum on September 18, 2012, 07:24:08 PM
This code

<div ="metebftinesc" style="position:absolute;top:-127px;left:44px;clip:rect(135px, 531px, 535px, 170px)">
<img src="http://www.buienradar.nl/images.aspx?jaar=-3&amp;bliksem=0&amp;voor=&amp;soort=loop1uur1x1_bliksem" height="627" width="700"  alt="" title="">
</div>
<DIV ="metrotines" style="position:absolute;top:14px;left:222px">
<a href=""><img src="http://weerforum.eu/wibisaradar/images/weerkaart.gif" width="343" height="358" border="0" title="" alt="" ></a>
</div>
Title: Re: How to center
Post by: Orangine on September 18, 2012, 07:37:08 PM
as long as the position is set to absolute you cannot center it
Title: Re: How to center
Post by: stylusss on September 18, 2012, 08:00:21 PM
<div ="metebftinesc" style="margin: 0 auto; position:absolute;top:-127px;left:44px;clip:rect(135px, 531px, 535px, 170px)">
<img src="http://www.buienradar.nl/images.aspx?jaar=-3&amp;bliksem=0&amp;voor=&amp;soort=loop1uur1x1_bliksem" height="627" width="700"  alt="" title="">
</div>
<DIV ="metrotines" style="margin: 0 auto; position:absolute;top:14px;left:222px">
<a href=""><img src="http://weerforum.eu/wibisaradar/images/weerkaart.gif" width="343" height="358" border="0" title="" alt="" ></a>
</div>


Try that ^^
Title: Re: How to center
Post by: weerforum on September 19, 2012, 04:22:42 AM
Quote from: stylusss on September 18, 2012, 08:00:21 PM
<div ="metebftinesc" style="margin: 0 auto; position:absolute;top:-127px;left:44px;clip:rect(135px, 531px, 535px, 170px)">
<img src="http://www.buienradar.nl/images.aspx?jaar=-3&amp;bliksem=0&amp;voor=&amp;soort=loop1uur1x1_bliksem" height="627" width="700"  alt="" title="">
</div>
<DIV ="metrotines" style="margin: 0 auto; position:absolute;top:14px;left:222px">
<a href=""><img src="http://weerforum.eu/wibisaradar/images/weerkaart.gif" width="343" height="358" border="0" title="" alt="" ></a>
</div>


Try that ^^

Sorry won`t work  :(
Title: Re: How to center
Post by: weerforum on September 20, 2012, 06:43:36 PM
No one  8) 8) 8) 8) 8) 8)
Title: Re: How to center
Post by: hcfwesker on September 20, 2012, 07:05:06 PM
Just a guess.

<div ="metebftinesc" style="position:absolute;top:-127px;left:44px;clip:rect(135px, 531px, 535px, 170px)" align="center">
<img src="http://www.buienradar.nl/images.aspx?jaar=-3&amp;bliksem=0&amp;voor=&amp;soort=loop1uur1x1_bliksem" height="627" width="700"  alt="" title="">
</div>
<DIV ="metrotines" style="position:absolute;top:14px;left:222px" align="center">
<a href=""><img src="http://weerforum.eu/wibisaradar/images/weerkaart.gif" width="343" height="358" border="0" title="" alt="" ></a>
</div>
Title: Re: How to center
Post by: weerforum on September 21, 2012, 04:33:38 AM
Quote from: hcfwesker on September 20, 2012, 07:05:06 PM
Just a guess.

<div ="metebftinesc" style="position:absolute;top:-127px;left:44px;clip:rect(135px, 531px, 535px, 170px)" align="center">
<img src="http://www.buienradar.nl/images.aspx?jaar=-3&amp;bliksem=0&amp;voor=&amp;soort=loop1uur1x1_bliksem" height="627" width="700"  alt="" title="">
</div>
<DIV ="metrotines" style="position:absolute;top:14px;left:222px" align="center">
<a href=""><img src="http://weerforum.eu/wibisaradar/images/weerkaart.gif" width="343" height="358" border="0" title="" alt="" ></a>
</div>


Nope sorry  ???
Title: Re: How to center
Post by: Hj Ahmad Rasyid Hj Ismail on September 21, 2012, 05:07:33 AM
Quote from: Orangine on September 18, 2012, 07:37:08 PM
as long as the position is set to absolute you cannot center it
I will have to concur with Orangine. You will need to remove position absolute. More preferably, do such styling in index.css file instead of hardcoded it into the template.
Title: Re: How to center
Post by: Kindred on September 21, 2012, 07:17:58 AM
well, first of all, why are you posting this in 2.x support?  This doesn't seem like anything native to SMF....

but second, why the heck are you using all those absolute positionings? Unless absolutely necessary you should almost always use relative positions.

third...   that's not valid html...
<div ="metebftinesc"

huh?

you need something BEFORE that = sign...   div class="..., div id ="...
Title: Re: How to center
Post by: Orangine on September 21, 2012, 08:42:15 AM
Good catch didn't see that!
Title: Re: How to center
Post by: weerforum on September 21, 2012, 08:45:10 AM
Ok Kindred i am sorry for asking here.
I will ask somewhere else.
Title: Re: How to center
Post by: Kindred on September 21, 2012, 08:47:57 AM
weer...   don't worry too much about it. It was more for the future.   Now that I'm back on the green team, I'll just bounce this over to coding help. ;)
Title: Re: How to center
Post by: weerforum on September 21, 2012, 08:52:31 AM
Thnx Kindred
I still don`t get it  :( :( :(
Title: Re: How to center
Post by: Kindred on September 21, 2012, 09:07:34 AM

<div id="metebftinesc" style="padding:0px;float:left;clip:rect(135px, 531px, 535px, 170px);">
<img src="http://www.buienradar.nl/images.aspx?jaar=-3&amp;bliksem=0&amp;voor=&amp;soort=loop1uur1x1_bliksem" height="627" width="700"  alt="" title="">
</div>
<div id="metrotines" style="padding:0px;float:right;">
<a href=""><img src="http://weerforum.eu/wibisaradar/images/weerkaart.gif" width="343" height="358" border="0" title="" alt="" ></a>
</div>
<div style="clear:both"></div>



this is what the code should look like.
However...   we can't help you adjust the relative positioning until we see the page itself or at the very least, the code this is being dropped into.  You can adjust the padding setting to help position the actual placement, without using silly absolute positioning.
Title: Re: How to center
Post by: weerforum on September 21, 2012, 09:24:49 AM
I have this now
Please see attachments.

<div id="" style="padding:0px;float:left;clip:rect(135px, 531px, 535px, 170px);">
<img src="http://www.buienradar.nl/images.aspx?jaar=-3&amp;bliksem=0&amp;voor=&amp;soort=loop1uur1x1_bliksem" height="343" width="358"  alt="" title="">
</div>
<div id="" style="padding:0px;float:left;">
<a href=""><img src="http://weerforum.eu/wibisaradar/images/weerkaart.gif" width="343" height="358" border="0" title="" alt="" ></a>
</div>
<div style="clear:both"></div>
Title: Re: How to center
Post by: weerforum on September 21, 2012, 10:05:14 AM
I solved it peeps.
Thnx for the help ;)

<html>
    <head>
        <style type="text/css">
        <!--
            body { margin: 0; padding: 0; }
            #weerwrapper { margin: 0 auto 0 auto; width: 361px; position: relative; }
            #buienradar { position: absolute; top: -135px; left: -170px; clip:rect(135px, 531px, 535px, 170px); height: 627px; width: 700px; }
            #weerforum { position:absolute; top:14px; left:10px; width: 343px; height: 358px; }
        //-->
        </style>
    </head>

    <body>
        <div id="weerwrapper">
   
             <img id="buienradar" title="Afbeelding Buienradar" src="http://www.buienradar.nl/images.aspx?jaar=-3&amp;bliksem=0&amp;voor=&amp;soort=loop1uur1x1_bliksem" />
   
            <img id="weerforum" title="Afbeelding Weerforum" src="http://weerforum.eu/wibisaradar/images/weerkaart.gif" />

        </div>
    </body>
</html>
Title: Re: How to center
Post by: Kindred on September 21, 2012, 10:15:50 AM
glad you fixed it...   but you are still using absolute positioning which is a poor choice.
Title: Re: How to center
Post by: weerforum on September 21, 2012, 10:41:28 AM
Do you have a suggestion Kindred ?
Title: Re: How to center
Post by: Kindred on September 21, 2012, 01:00:01 PM
oh...   I see what it's doing with that stuff...   it's doing an overlay

Ugly, messy coding...   but I guess you can leave it, since it would take more effort to plan positioning than it's probably worth....