Forums

[resolved] Problem with how to set the height to adjust to the content, custom theme.. (6 posts)

  1. andersdrage
    Member
    Posted 2 years ago #

    I´m making my first custom theme, you can check it out at LINK. But I have a big problem with setting the css to adjust to the content..

    This is the code in the pages.. Just the divs..

    The main div is the one with the opacity on, and then it´s the one with the content which is mainContent, and then theres one with the text in it..

    <?php get_header(); ?>
    		<div id="main">
    				<div id="mainContent">
    					<div id="primary"></div>
    				              <div class="post-item">
    				              </div> <!-- end post-item -->
    					</div><!-- end primary -->
    				</div><!-- end mainContent -->
    		</div><!-- end main -->
    <?php get_footer(); ?>
    #main {
     clear: both;
     overflow: hidden;
     background: #daa6c0;opacity:.90;
     width: 960px;
     height: 1500px;
     position:absolute;
     top:246px;
    }
    #mainContent {
     clear: both;
     overflow: hidden;
     background: url(img/bgmaincontent.jpg);
     width: 884px;
     height: 1500px;
     position:absolute;
     top:79px;
     left: 38px;
     margin: auto;
    }

    I want the pages to adjust to the content, now I have set the hight, but I what should I do to make it adjustable?

    Thanks so much,
    Anders

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Why do you need to set an absolute height on #main and #mainContent? If you omitted height, the page lengths would remain elastic and you wouldn't be forced to set overflow to hidden.

  3. andersdrage
    Member
    Posted 2 years ago #

    I just have it now, because when I remove the height on the main, nothing shows.. And I cant understand why!

  4. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    Get rid of the absolute positioning on both #main and #mainContent and I think you'll find that they'll work quite nicely without a height.

  5. andersdrage
    Member
    Posted 2 years ago #

    Thank you so much, worked like a charm! But is there anyway I can place the main div over the "logo illustration" at the upper left corner?

  6. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    You seem have figured it out before I got back here. :-)

Topic Closed

This topic has been closed to new replies.

About this Topic