Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kevon K. Hayes 255 posts 281 karma points
    Jun 30, 2010 @ 23:51
    Kevon K. Hayes
    0

    Centering in IE7 Using Umbraco 4.0.3

    I have the following CSS that centers my layout perfectly in IE7.

     /*CSS for COR IE7*/
    div
    {   
        padding:0;
        margin:0;
    }

    .corMainWrapper
    {
        position:relative;
        height:980px;
        width:980px;
        margin-left: auto;
        margin-right:auto;
        top: 25px;
    }

    .corPreMenuLeft
    {
        position:relative;
        width:240px;
        padding: 0px;
        margin: 0px;
        /*IE 7 FIX*/
        zoom:1;
        display: inline;
        height: 95px;
    }

    .corPreMenuCenter
    {
        position:relative;
        width:490px;
        top:-15px;
        /*IE 7 FIX*/
        zoom:1;
        display: inline;
        height: 95px;
    }

    .corPreMenuRight
    {
        position:relative;
        width:220px;
        /*IE 7 FIX*/
        zoom:1;
        display: inline;
        height: 95px;
    }

    but when I reference the same CSS in Umbraco nothing happens... everything is left aligned.  I read up on "hasLayout" and all my divs indeed have layout but still nothing will center.

  • Paul Blair 466 posts 731 karma points
    Jul 01, 2010 @ 00:07
    Paul Blair
    0

    Hi,

    You can drive yourself crazy sometimes trying to figure out why something is not working with CSS. Use firefox and use the fire-bug add-on. You can then right click on a element and inspect it. In this example for you might find another style is overwriting your styles or your styles are not getting applied for some reason.

    Cheers

    Paul

  • Tom Madden 253 posts 455 karma points MVP 4x c-trib
    Jul 01, 2010 @ 01:03
    Tom Madden
    0

    Have you a link to the page? Also, if the css is okay, check there aren't errors in the html. I use the HTML Validator plugin for Firfox to always validate my pages as I browse.

    HTH

    Tom

  • Magnus Eriksson 122 posts 362 karma points
    Jul 01, 2010 @ 16:52
    Magnus Eriksson
    0

    What do you mean by "in Umbraco", is it in the rich text editor you're trying to use your CSS? I've found it a bit tricky at times to get all styling as wanted in the RTE but as Paul says firebug is a great tool for debugging CSS (although it might not help as much if you're only having the problem in IE7).

    Regards,
    Magnus

  • Kevon K. Hayes 255 posts 281 karma points
    Jul 01, 2010 @ 17:35
    Kevon K. Hayes
    0

    I used do use firebug..., in IE and Opera via Firebug Lite, thanks for the suggestion, my problem turned out to be a quote being outside an element, and a mis-spelled style in my html which I found after reviewing the markup in the IE Dev Toolbar.  However, to solve my centering issue I had to do the following. 

    I had to add body{text-align: center} to center my layout.  It's ironic, I do NOT have to do this outside of umbraco.  My CSS in IE7 on a regular aspx page just works.  It appears that IE7 in umbraco ignores:

    margin-right:auto;
    margin-left:auto;

    Oh well thanks for the help, it was very much needed.

  • Tom Madden 253 posts 455 karma points MVP 4x c-trib
    Jul 01, 2010 @ 17:52
    Tom Madden
    0

    Kevon,

    Umbraco doesn't change anything about the front end css/html of your site. You are in complete control. If you post a link to a sample page, I'm sure someone will be able to tell you what it is. Did you validate both your html and css and check the rendering mode in use (standards or quirks)?

    IE can also be a bit fussy about spacing or ommission of attribute values in shortcuts. I used to come across this all the time with background images not appearing in IE for example.

    Regards

    Tom

     

  • Kevon K. Hayes 255 posts 281 karma points
    Jul 01, 2010 @ 18:33
    Kevon K. Hayes
    0

    Yes, I did yesterday and now that I remember,The validator did yell at me for not having a Doctype defined... I commited the great sin that web developers should never make.  I left our the Doctype, and never went back and fixed it.  So I added it back just now and GUESS WHAT... Centering Works... margin-right:auto; and margin-left:auto; is no longer ignored.  My page is perfectly centered with the correct markup.

    THANKS quixltd you rock!

  • Kevon K. Hayes 255 posts 281 karma points
    Jul 01, 2010 @ 19:12
    Kevon K. Hayes
    0

    FYI:  I didn't mean to make Umbraco sound less than what it is (The most AWESOME CMS on the Planet).  I just explained what I noticed.  However, I admitted where my error was above.  I'm commited to Umbraco which is why I purchased the PRO Version.  I very much want to see this project stay around for decades to come.

    I hope this clear things up.

  • Folkert 82 posts 212 karma points
    Jul 05, 2010 @ 16:50
    Folkert
    0

    I'm using the 960 grid system for some time now and it save lots of time, have a look at:

    http://960.gs/

    I've created a package to install some sample templates and examples(based upon the 960 grid framework):
    http://dibbus.com/umbraco/umbraco-template-package/

  • Kevon K. Hayes 255 posts 281 karma points
    Dec 15, 2010 @ 05:18
    Kevon K. Hayes
    0

    @Folkert 960 is nice.  I'll have to take a look at in on my future projects.

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Dec 15, 2010 @ 05:49
    Aaron Powell
    0

    Here is HTML + CSS to centre align content cross all browsers:

    <!doctype html>
    <head>
     <title></title>
     <style type="text/css">
      body {
       width: 100%;
      }
      #content {
       margin: 0 auto;
       width: 900px; /* this is the width that you're wanting for your body, 900px is safe for a 1024 res */
       text-align:center;
      }
     </style>
    </head>
    <body>
     <div id="content">
      <!-- content here -->
     </div>
    </body>
    </html>

  • Kevon K. Hayes 255 posts 281 karma points
    Dec 15, 2010 @ 05:57
    Kevon K. Hayes
    0

    thanks slace.

Please Sign in or register to post replies

Write your reply to:

Draft