How can I change where a cfmenu is placed within a page?

528 Views Asked by At

I have a cfmenu that I created on my web application. The problem is that it automatically places itself at the very top-left of the page, even though I have included it at a certain place within the code.

Is there a way to position a cfmenu? What can I do to place it where I want it to go?

3

There are 3 best solutions below

0
On

I think you can use the menuStyle and childStyle attributes of the <cfmenu> tag (docs) to add CSS styles to the generated HTML and then use CSS on your webpage to position/style the menu as you wish.

0
On

Your cfmenu needs to be in a container of some sort to position it. For example, this would put the menu at the 100x100 position in the browser:

<html>
    <head></head>
    <body>
        <div style="position: absolute; top: 100px; left: 100px;">
            <cfmenu name="myMenu">
                <cfmenuitem name="myMenuItem" display="My Menu" href="index.cfm" />
            </cfmenu>
        </div>
    </body>
</html>

I've also placed cfmenus in table cells and other containers. You just need to make sure the menu's container is placed where it's supposed to be. Without further code to show how you're placing the menu in your code, there's no way to know for certain why it's not landing where you want it.

0
On

I must have not been awake this morning. The problem was that I wanted it inside this table, but neglected to include the necessary "tr" and "td" tags. It is now where I want it.