Dynamically Size a div ?

Hello~
I have a CSS-based navigation bar that is populated from a database. Right now, I am hard-coding the width of each button (using a 1-image as a repeating background) in the CSS file, but I was wondering if anyone had an idea of how to set that div width for each button based on how many links are found in the database? FOr example, the containing div is 710 pixels wide, and right now I have 6 divs that contain a nav button and link, but they are each hard-coded to be 116 pixels wide. If I change the number of links in the database, I will have to change the CSS code as well. I would love to find a way around this! Thanks for any suggestions!
KC

Ummm...  Use a CFML variable to define the desired width of the div.  Use whatever logic you want to calculate the value of that variable?
This is no different then dynamically generating any other content to send to a client browser.
The only gotcha there maybe here is if you have all your CSS seperated into a css file.  This is, of course, because a CSS file is not normally passed to ColdFusion by a web browser for processing of dynamic content.
You have several choices on how to handle this.
1) Include a small portion of the CSS in the regular CFM file.  You do not need to include all your css, just the part you want to make dynamic.
2) Make your CSS file a CFM file.  There is nothing illeagal about naming your css file something like 'myCSS.cfm'.  And then linking to that in your HTML content.  This file will then be process by ColdFusion.  This can cause issues where a browser may or may not cache a dynamic cfm file the same as it would a static css file loosing some of the benifit of seperating the style content.  This can be mitigated by providing the proper headers to the css content with <cfheader...> tags so that the browser will cache the content as desired.
3) Configure your system to pass css files to ColdFusion for processing.  This has the same caching issues with nameing your file with a cfm extension with the same solution.  It also has the added benifit that your files will have a normal css extension so that many editors will knwo how to propelry highlight and code hint the file that often does not work correctly with files ending in cfm.  But it can lead to uncessary server load if little of the CSS is dynamic as well as will not be allowed with most shared hosting providers.

Similar Messages

  • How to crate a dynamic size array, collection

    Hi,
    Can someone point me to some tutorial on how to create a dynamic size array. Actually I have multiple cursors and on different tables and want to loop through each cursor and get some values from each cursor and put it in an array. But don't know how to create or initialize an array as I don't know the size. Is there any other way.
    Here is what I am doing I have 6 cursors on different tables, I loop through each cursor and get some specific data that I need to place at one place after looping through all the cursors which then finally needs to be inserted in one table. But before the insert I need to validate each data so want to have all the data in some array or some other place for temporary storage from it's easier to do the validate and insert rather than while looping through the cursors as there may be duplicates which I am trying to remove.
    As this procedure will be called multiple times so wanted to save the cursor data in temporary array before inserting in the final table. Looking for some faster and efficient way.
    Any help is appreciated.
    Thanks

    guest0012 wrote:
    All the 6 cursors are independent and no relation i.e. can have a join and have one sql as no relationship in tables.If there is no relation, then what are your code doing combining unrelated rows into the same GTT/array?
    Now using GTT when I do an insert how do I make sure the same data doesnot already exists. i.e. GTT will only have one column. Then create a unique index or primary key for the GTT and use that to enforce uniqueness.
    So everytime I iterate over a cursor I have to insert into GTT and then finally again have to iterate over GTT and then do an insert in the final table which maybe a performance issue Which is why using SQL will be faster and more scalable - and if PL/SQL code/logic can be used to glue these "no relationship" tables together, why can't that not be done in SQL?
    that's why i was wondering if can use any kind of array or collection as it will be a collection of numbersAnd that will reside in expensive PGA memory. Which means a limit on the size of the collection/array you can safely create without impacting server performance, or even cause a server crash by exhausting all virtual memory and causing swap space to trash.
    and finally will just iterate ovr array and use FOR ALL for insert but don't know what will be the size of the array as I only know after looping the cursors the total number of records to be stored. So wondering if how to do it through collection/array is there a way to intialize the array and keep populating it with the data with defining the size before hand.You cannot append the bulk collect of one cursor into the collection used for bulk collecting another cursor.
    Collections are automatically sized to the number of rows fetched. If you want to manually size collection, the Extend() method needs to be used, where the method's argument specifies the number of cells/locations to add to the collection.
    From what you describe about the issue you have - collections are not the correct choice. If you are going to put the different tables's data into the same collection, then you can also combine those tables's data using a single SQL projection (via a UNION for example).
    And doing the data crunching side in SQL is always superior in scalability and performance, than doing it in PL/SQL.

  • Dynamically size movieclip to fit text's string height and width

    Hello,
    I am trying to dynamically size a movieclip to fit the size of a text's string height and width (This text is inside the movieclip)
    here is my code so far..
    var Font1_ = new Font1();
    var Format2:TextFormat = new TextFormat();
    Format2.size = 36;
    Format2.align = TextFormatAlign.CENTER;
    Format2.font = Font1_.fontName;
    var MessageBox:MovieClip = new MessageBoxMC();
    MessageBox.Text1.defaultTextFormat = Format2;
    MessageBox.Text1.embedFonts = true;
    MessageBox.Text1.antiAliasType = AntiAliasType.ADVANCED;
    MessageBox.Text1.wordWrap = true;
    MessageBox.Text1.width = 800;
    MessageBox.Text1.height = 400;
    MessageBox.Text1.textColor = 0xFFFFFF;
    MessageBox.Text1.cacheAsBitmap = true;
    MessageBox.Text1.mouseEnabled = false;
    MessageBox.Text1.text = String("Use the Arrow Buttons to move");
    MessageBox.width = MessageBox.Text1.width;
    MessageBox.height = MessageBox.Text1.height;
      MessageBox.x = 400;
      MessageBox.y = 200;
      addChild(MessageBox);
    this isn't working for me.. anyone know the best way to do this?
    I also want the text to be centered in the movieclip, with a border of around 2-4 pixels
    I am also not sure if i should be using text.length? any advice and input is greatly welcomed.
    thanks in advance!

    Essentially, you need to check for a change in .textWidth or .textHeight, which are different from .width and .height.
    This code works for me (assumes a background box called bg and a foreground text instance fg inside a moveclip and an X and Y bounds offset variable to say how far away you want the box from the text and a textFrameNudge to provide a tweak value).
         // Resize background box
         thisBox.bg.x = thisBox.fg.x - boundsOffsetX + textFrameNudge; // I'm using .4 as the tweak value for textFrameNudge
         thisBox.bg.y = thisBox.fg.y - boundsOffsetY;
         thisBox.bg.width = thisBox.fg.textWidth + boundsOffsetX*2 +textFrameNudge*thisBox.fg.getTextFormat().size;
         thisBox.bg.height = thisBox.fg.textHeight + boundsOffsetY*2;

  • Maximum size for div

    I have a div tag that is set to 300px height and 'overflow: auto' to start the scroll when the content gets larger. It would be nice to have that size flexible, so it fits snug around smaller content and switches to scroll bars when it exceeds 300 pixels. Possible?

    Have a look here http://www.w3schools.com/CSS/pr_dim_max-height.asp
    Gramps

  • Dynamic size of column header

    How do I make the header row of a column in a Jtable to dynamically adjust it's size to it's contents??
    Need this
    |HEADER COL1||HEADER COL2.....|H C3|
    Have this
    |HEADER C||HEADER C|H C3|
    Thanks!

    You need to get the column model and each column in turn and then set the width there.

  • Dynamic size box in Java 3D

    Hi,
    I have two problems regarding the dynamic box in java 3D:
    1. how can I change size of the box during runtime? I want to draw a 3D bar chart like using box.
    2. what is "Exception in thread "AWT-EventQueue-0" javax.media.j3d.BadTransformException: TransformGroup: non-affine transform"? I encountered this when using a percentage (a value / max value) to create a box.
    below is my portion of code:
    I have methods to set the propValue, maxValue, sideX and sideZ. I update these values using setter to change the Box, but I think I need to have one more method to update the box (calling createSceneGraph() ).
    protected Group createSceneGraph()
    visualRep = new BranchGroup();
    float scaleFact = 1.0f; // scaleFact is used only for debugging purpose
    float percentage = propValue / maxValue;
    // I want to move the height to half of its height, they are different for each
    // module since the height is affected by the percentage. But, every time I add
    // percentage to the "itsHeight", it gives me error : Exception in thread
    // "AWT-EventQueue-0" javax.media.j3d.BadTransformException:
    // TransformGroup: non-affine transform
    //float itsHeight = ( HEIGHT * percentage );
    float itsHeight = ( HEIGHT );
    // 1. Create the box
    Box vis = new Box(
    sideX * percentage * scaleFact,
    itsHeight * scaleFact,
    sideZ * percentage * scaleFact,
    Box.GENERATE_NORMALS,
    LCMPlanning.getInstance().getAppearance( this.getModule(),
    LCMPhysical.DEFAULT_WALL ) );
    vis.setCapability( Box.ENABLE_APPEARANCE_MODIFY );
    // 2. Move the first box to the top of the ground level
    Transform3D t3d = new Transform3D();
    t3d.setTranslation( new Vector3f( 0.0f, itsHeight, 0.0f ) );
    TransformGroup tg = new TransformGroup( t3d );
    tg.addChild( vis );
    tg.setCapability( TransformGroup.ALLOW_TRANSFORM_WRITE );
    visualRep.addChild( tg );
    return visualRep;
    thanks a lot.
    Daniel

    Hi,
    Nobody answered your questions so far? Here's my take.
    Changing the size of the box at runtime:
    The easiest way to do that is to scale the transform using transformName.set(double scale) or transformName.setScale(double scale).
    Non-affine transform error:
    I get this error every once in a while. With me it happens when I try to assign a value of infinity or a NaN (not a number) to one of the params in the transform. I suggest printing the params you are using to create the box.
    sideX * percentage * scaleFact,
    itsHeight * scaleFact,
    sideZ * percentage * scaleFact,
    You may not be specifying what you think you are specifying.
    Hope that helps.

  • Correlating image size with DIV size

    Dreamweaver gives me the option called Draw AP DIV.
    (I am guessing this means to define the boundaries of an absolutely positioned Div)
    When inserting an image into a DIV that is created in this manner, is there a way to constrain the size of the image
    to equal the boundaries of the drawn DIV?

    Repost, Urgent, please help

  • Dynamic refresh of DIV only

    Sorry if this is a naive question, I'm coming late to HTML
    via Flash and PHP. I can change a page content using a dynamic href
    eg www.mysite.com?page=products but this reloads the whole page. Is
    there a way to refresh the contents of just one DIV?

    You would have to use client-side javascript for that.
    Investigate DW's
    SPRY, or AJAX....
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "Bob Pierce" <[email protected]> wrote in
    message
    news:fsljfc$1hh$[email protected]..
    > Sorry if this is a naive question, I'm coming late to
    HTML via Flash and
    > PHP. I
    > can change a page content using a dynamic href eg
    > www.mysite.com?page=products
    > but this reloads the whole page. Is there a way to
    refresh the contents of
    > just
    > one DIV?
    >

  • Adding dynamic size table to Interactive Form

    Hello everyone,
    I have a node with multiple elements that i would like to show in an interactive pdf form.
    I'm using the Adobe LiveCycle Designer to do it, but i'm only managing to bind "solo" variables, not tables.
    How can i associate dynamically a table with several lines to a pdf interactive form ? I tried a list box but i still only get the first element shown in the box. Am i doing anything wrong ?
                 Thank you in advance.
                           Nuno Santos

    Hi,
    Basically the general way to add a table to INteractive form is by adding a subform elemet to a subform element and(i mean subform in a subform), now map the fields u want to be displayed as a table.
    For the fisrt subform set the LayoutType-Flow Content,Flow DirectionTable.
    Then select the allow page breaks within the content option.
    And the binding should be Normal.
    for the second subform:
    LayoutType-Flow Content,Flow DirectionTable row.
    Now also select the option allow page breaks.
    Then for Binding tab: select the Repeat Subform for each data Item, then min count=1.
    And now if ur table columns contain names like abc, def and xyz.
    Then in the script editor code something like this
    abc[*]; under show: initilaze, language: Formcalc and Run at: client
    Hope this should work out for you.
    let me know if u have any more queries.
    Thanks,
    Lohi

  • Multi-dimensional array with dynamic size - how to?

    Hi
    I have a CONSTANT number of buckets. Each of them has to take a VARIOUS number of data series. The data series have one VARIOUS length per bucket. I'd like to index the buckets like an array to loop over them.
    So basically I need something like a multidimensional array with constant first dimension (bucket index), but dynamic second (data series index within bucket) and third (data point index within data series) dimension. What's the best way to do so?
    I should also remark that data series can get really big.
    Thanks in advance and best regards,
    Michael

    Hi Michael,
    the usual way is to use an array of cluster.
    Put your "2nd" and "3rd" data into a cluster and then make an 1D array of that cluster...
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Picture with dynamic size?

    Hello,
    I post a Picture (OLE) on an CR Page. Depending on the parameters in the report, differnt pictures with different Sizes are selected. Now I want to fix the maximal hight and width of the space I reserve for the picture but keep the ratio between hight and width of the original. How can i do this?

    To achieve
    "Depending on the parameters in the report, differnt pictures with different Sizes are selected."
    Use conditional hiding in sections or in object hiding. Formula you can write.
    Right click any object  and select 'size and position'. There also you can write formula .
    or
    format the object you can find hieght widht write formula to meet the requirement.
    Regards
    Usma

  • Dynamic growth using div's

    I have a page in which the user can add a table as many times as they wish and also remove any of these at any time. I have come up with numerous algorithms using <div>'s, all which seem to have some problem.
    Ideally, I'd have liked to have
    <div id="1"></div>
    <div id="2"></div>..etc where on each click another div is added right after the next. I thought of implementing this by calling the latest created and updateing its innerHTML with tableCode(whatever code defines the table) + "</div><div id=(nextID)>" This is kinda like a trick to end the first div and start the next and use the first one's </div> to now end the next. Didn't work...stupid browsers "fix" it for you adding a <div> before the </div>.
    Ok, next I thought of adding each new <div> at the end of the previous, creating a nest. It was pretty cool, but posed problems for removing (one would have to absorb its child then update all its children).
    Finally, I used an outer div, which I added each new div to its end. The problem with this, is each time I add one, the outer div is essentially rewritten, losing any input the user has put in the previously added tables.
    If you can think of an easier way to do this (without losing data on each addition!), please let me know.
    Thanks!
    Note - I didn't use the outerHTML function because it is not supported on all browsers (e.g. Mozilla Firefox).

    I can get them to appear one under each other, but not side by side. Can anyone help?
    Sure we can help if you post a link to your work which we can see in our browsers so that we can suggest an improvement to your code.
    hth

  • Dynamic size

    hello here is my code ...
    db[] dbapp = new db[];
    compile:
    [javac] Compiling 12 source files to D:\PADMA\work\APPLIC~1\PRINTING\SOURCE~
    1\build
    [javac] D:\PADMA\work\APPLIC~1\PRINTING\SOURCE~1\Source\DbController.java:15
    6: array dimension missing
    [javac] DbApplication[] dbapp = new DbApplication[];
    here my db array may be dynamically changes.... so how would declare the array
    plz help me asap

    but plz write a code for that.... here i am unable to initialise the array
    DbApplication[] dbapp = new DbApplication[];
    here compiler is asking for dimension.... but i do not want to provide the dimension since it will change dynamically....
    plz asap

  • Load the dynamic page in div in jsp

    hi all,
    I have develop the webpage using div & css in that when i click on left menu link url of that menu is call & result page is disply from the java files.I have to show that result page in one div.But i have face the problem to display that page in div.Which attribute or functionality is used to load that page in that div.I have to make the same functionality which is done using iframe.
    Please reply me

    thanks a lot....
    Now i m trying to donfigure jstl in my project.But i have used jDeveloper 10g.So i have no idea about how to configure JSTL in that.I have placed c.tld in web-inf folder & also place jstl.jar,standard.jar into the web-inf/lib folder.In jsp i have add this line :: <%@taglib prefix="c" uri="/WEB-INF/c.tld" %>
    After that i have used any of the tag of c that give me the error like this ::::
    cannot access class org.apache.taglibs.standard.tag.el.core.OutTag; java.io.IOException
    Please help me whats the problem in configuration......

  • How to have dynamic size of the content area

    Hello everyone
    I am trying to create a printable adobe form using Adobe LiveCycleDesiner 8.
    Here is my problem.
    The PageMaster is containing the company Logo, Address and the ship to address.
    The ship to address can be composed by up to 11 lines. Those lines are not always used. Some addresses have only 5 lines.
    If I am reserving those 11 lines before the content area, we are loosing alot of space that can be used for the body page.
    So the question is:
    Is it possible to have a flowed content area? Where the size of the content area would be driven by the available space of the PageMaster?
    Regards
    stjacqd

    Hello Carsten
    The subform has no impact to the content area size.
    The subform has an impact only inside the content area or inside another  form.
    My point is:
    PageMaster
    |  Logo                                          |
    | Address1                   Address      |
    | Address2                   Address      |
    | Address3                   Address      |
    | Address4                   Address      |
    | Address5                   Address      |
    | Address6                   Address      |
    | Address7                   Address      |
    | Address8                   Address      |
    | Address9                   Address      |
    | Address10                 Address      |
    | Address11                 Address      |
    |---------------------------------------------------|
    | Content area                               |
    |                                                   |
    So, inside the Page Master there is 11 lines reserved for the addresses,
    But at the printout, if there are only 3 lines used for the address, I would like to reassign the space used by the address4 through adderss11 to the content area.
    So the result at printout will look like:
    |  Logo                                          |
    | Address1                   Address      |
    | Address2                   Address      |
    | Address3                   Address      |
    |---------------------------------------------------|
    | Content area                               |
    |                                                   |
    Instead of:
    |  Logo                                          |
    | Address1                   Address     |
    | Address2                   Address     |
    | Address3                   Address     |
    |                                                   |
    |                                                   |
    |                                                   |
    |                                                   |
    |                                                   |
    |                                                   |
    |                                                   |
    |                                                   |
    |---------------------------------------------------|
    | Content area                               |
    |                                                   |
    Regards

Maybe you are looking for

  • Duplicate todos in Mail.app

    Hi, My todos have recently started duplicating themselves inside Mail.app (strangely there are no duplicates in iCal!). Can anyone suggest why this might be happening? I have an iPhone syncing 'over the air' with MobileMe. I don't have any other sync

  • Facing issue in Connecting to Oracle 10g database in OBIEE+

    Hi All I have done the BASIC installation of OBIEE+ on Windows [local system]. I have tested for all the services running and they are running fine. As Oracle 10g is our databse i need to connect to the databse. Please guide me with step by step proc

  • My Adobe 3 Photoshop won't open pictures.

    Can I uninstall and re-install?

  • HELP! X61 Tablet Bluetooth and intern mic with Windows 7 RC

    Hello, I have currently installed Windows 7 on my X 61 Tablet, model 7767 BFG. I can say it works much better than Vista. Only prob is that my Bluetooth hardware cannot be used anymore (it is not detected). Does anyone has an actual driver for this h

  • PI7.0 Configuration Guide

    I need PI 7.0 configuration guide. Can someone please post a link. I couldn't find it. I found the XI3.0 configuration guide at https://websmp102.sap-ag.de/~sapidb/011000358700001697502004E.PDF Thanks