Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2012
    Location
    Calgary, Alberta, Canada
    Posts
    24
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Combing an inline DIV statement with a CSS

    On my web page I want the height of a DIV box to be based on a value. (This value is set by javascript depending on other content that is generated by ther javascript I have).

    I also want this DIV box to refer to a CSS.

    So in example:

    Code:
    .setmaincontainer {
        width: 835px;
        height: 507px;
        background: #aeaeae;
        border: 2px solid #e5e5e5;
        text-align: center;
        margin: 0 auto;
    }
    I want to omit the "height: 507px;" in this CSS and instead reference the height on the webpage, which I currently use in Javascript:

    Code:
    document.write('<div class="setmaincontainer">');
    I'm unsure if I can some how add a height setting after the reference to the DIV class? Is this something I would use span tags for? (Sorry, I am very new to all of this.)

    I have tried this, but it does not work:
    Code:
    document.write('<div class="setmaincontainer" style="height: 507px;">');
    Note: I will be replacing the fixed reference of "507" to a value.

    Thanks.
    Last edited by helpneeded22; 09-21-2013 at 07:52 PM.

  • #2
    New Coder
    Join Date
    Sep 2012
    Location
    Calgary, Alberta, Canada
    Posts
    24
    Thanks
    3
    Thanked 0 Times in 0 Posts
    I got it to work now.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •