CSS Positioning

So web designing always seemed to be my thing and i decided to tackle my film studio's website for the hell of it... and i'm already coming up with some problems...

I'm trying to move a picture up so that it looks better and is in the spot i want it in... So far it hasn't budged for me...

Here's the code... I don't know how good it is but i think it's pretty basic for now, haha

is there anything anybody can see wrong?
[PHP]<html>
<head>
<title>Evil Empire Productions :: Main Page</title>
<link rel="stylesheet" type="text/css" href="csscode.css" />
<style>
.position{
postion:relative;
top:-100px;
}
</style>
</head>
<body>
<div align="center" style="margin: 0px auto; width: 700px;"><img src="images/tribal_header_double.gif" style="z-index:2;" /></div>
<div align="center" class="position" style="margin: 0pt auto; width: 700px;"><img src="images/ee_logo.gif" style="z-index:1; " /><p class="position">testing testing testing testingtesting testing testing testingtesting testing testing testingtesting testing testing testing</p></div>
<div style="margin-top: 100px; margin-left: auto; margin-right: auto; width: 700px;" >
<div style="width: 150px">
</div>
<div style="width: 550px">
</div>
</div>
</body>
</html>[/PHP]
btw, the testing is just to see if i could move that and there was just something wrong when moving the img/div

Comments

  • RWBRWB Icrontian
    edited July 2007
    Try changing the post editor using the strange A/A icon at the top right corner... then post the code. Make sure to put the code in [ PHP ] tags
  • LincLinc Owner Detroit Icrontian
    edited July 2007
    RWB wrote:
    Try changing the post editor using the strange A/A icon at the top right corner... then post the code. Make sure to put the code in [ PHP ] tags
    Yup.

    And, if you post the link, I'll look at the site too...
  • edited July 2007
    ah... thanks on how to do it... and i would give you the link but it's offline... im making it locally first
  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian
    edited July 2007
    I've got some CSS tutorials on my blog - link in sig
  • LincLinc Owner Detroit Icrontian
    edited July 2007
    Err, well, this is pretty hard not knowing what pic you're trying to move up, what it looks like, or what's in that embedded CSS file. Not enough info :-/

    //edit: Is it tribal_header_double.gif that you want flush against the top of the page? Perhaps the 'body' tag has padding on it by default. Try body {padding:0;}.

    Check this out:

    [php]html, body, div, span, p, h1, h2, h3, h4, h5, h6, ul, ol, li, img, a, abbr, acronym,
    b, br, em, embed, form, hr, label, object, s, q, blockquote, strike, strong,
    table, tbody, td, tfoot, thead, th, tr, tt, u { margin: 0; padding: 0; } [/php]I use that to start my CSS declarations on sites I make. See, every browser has different margin and padding defaults on elements. By setting all of them to zero to start, you eliminate headaches and make all browsers the same in that regard. Then, you build them backup again as you go along on your own terms. :) (Idea is from Eric Meyer)
  • edited July 2007
    http://i77.photobucket.com/albums/j76/MagnetTalk/eempire.jpg
    I'm trying to move the bottom picture on top of the banner...

    as for the embedded css, it's only borderless pics and black background

    [PHP]img{
    border:none;
    }
    body{
    Background-color:#000000;
    }[/PHP]

    also if you notice, my Firefox is acting kind of weird... in the picture, even though I'm on my site's tab, the title bar and address bar say I'm on the forum page... I've had this happen to me a lot lately and don't know what's wrong...
  • LincLinc Owner Detroit Icrontian
    edited July 2007
    Getting elements to appear out of order is tricky; I recommend simply putting the lower image above the banner in the HTML rather than trying to haxxor it with CSS. The only way to do that with CSS is to use absolute positioning.
  • edited July 2007
    so there's no way to do it with relative positioning? and is there any downside to absolute positioning?
  • KentigernKentigern Milton Keynes UK
    edited July 2007
    Hi this isn't exactly css but it does the job in ie6 & ff2
    Using my pics your script produces
    yourscript.jpg
    the following script again using my pics produces
    myscript.jpg


    You would have arrange the position's left and top on each pic txt etc.
    [PHP]
    <html>

    <head>

    <title>Evil Empire Productions :: Main Page</title>
    <link rel="stylesheet" type="text/css" href="csscode.css" />
    <style>
    .position{
    postion:relative;
    top:-100px;
    }
    </style>
    </head>

    <body>

    <p><span style="z-index: 0; position: absolute; left: 130; top: 15">
    <img src="images/PH02373J.JPG" width="450" height="297"></span> </p>
    <p><span style="z-index: 1; position: absolute; left: 232; top: 70">
    <img src="images/WB02068_.GIF" width="227" height="176"></span> </p>
    <span style="z-index: 2; position: absolute; left: 130; top: 385">
    <p class="position">testing testing testing testingtesting testing testing
    testingtesting testing testing testingtesting testing testing testing</p>
    </span>

    </body>

    </html>[/PHP]
  • LincLinc Owner Detroit Icrontian
    edited July 2007
    Kentigern, that is indeed precisely CSS ;) That general idea is precisely what I had in mind when I suggested absolute positioning.

    There are indeed drawbacks, like that worrying about people using different sized resolutions. Also, it will never ever move - sometimes good in the case of a banner, generally bad in the case of images in the middle of an article (the images won't stay with the text - they'll float in the same place, and the text won't wrap). I'm sure Google can yield a much more detailed look at when and when not to use absolute positioning. Yours is a case where I recommend reversing the order of the images instead.
  • KentigernKentigern Milton Keynes UK
    edited July 2007
    Keebler wrote:
    Yours is a case where I recommend reversing the order of the images instead.

    Hi Keebs, (I'm learning by my mistakes :)) explain please, when I reversed the order (z-index) the cream square went behind the brown.
  • edited July 2007
    ok, thanks for all the help guys :D
  • LincLinc Owner Detroit Icrontian
    edited July 2007
    The z-index is the layering. The highest-number z-index is what will appear on top if two things are occupying the same space (and there's no limit to how high the z-index can go).

    I meant to reorder the HTML (putting one image before the other in the HTML code), not to alter the z-index (which I hadn't really been paying attention to).

    //edit: Perhaps we have different ideas of what "above" means. I took it to mean "above it on the y index", as in higher than the banner on the page. If you meant layered above it on the z-index, then Kentigern's example would be fine unless you really want to get pedantic about a properly-ordered HTML hierarchy.
  • edited July 2007
    yea, i was talking about them in the same space, the bottom one layered over the top... but i have a nice quick solution to that, photoshop them together :D
  • LincLinc Owner Detroit Icrontian
    edited July 2007
    +5 points for simplicity
  • edited July 2007
    Keebler wrote:
    Check this out:

    [php]html, body, div, span, p, h1, h2, h3, h4, h5, h6, ul, ol, li, img, a, abbr, acronym,
    b, br, em, embed, form, hr, label, object, s, q, blockquote, strike, strong,
    table, tbody, td, tfoot, thead, th, tr, tt, u { margin: 0; padding: 0; } [/php]

    Great idea that, i might nick that.

    Good idea to stick fieldset in there too... since xhtml 1.1 has a fit if you don't declare them in strict :(
  • LincLinc Owner Detroit Icrontian
    edited July 2007
    IIRC, Eric's rationale for not including form elements (including fieldset) is that browsers interpret their margin and padding in differing ways, so setting them universally like that may exacerbate the issue rather than level the field.
  • edited July 2007
    fair play :)

    fieldset for me in my most recent was the cause of some weird padding issues, solved by margin:0, padding:0 :)
Sign In or Register to comment.