跳至內容
選單
此問題已被標幟
1 回覆
265 瀏覽次數

Hello please I would like to know how to add customized css to my menu with odoo I tried with the code injection in the head but it does not work and with a module that I installed it canceled the basic css of the site

頭像
捨棄
最佳答案

Hii,

Create a custom module:

Write Your CSS ( custom_menu.css ):

Example: Styling the website's top menu bar

.o_main_navbar { background-color : #222 !important ; border-bottom : 2px solid #00aaff ; } .o_main_navbar .nav-link { color : white !important ; font-weight : bold; }

Set css as per your requirements 

Define the CSS in QWeb Assets ( assets.xml )

<?xml version="1.0" encoding="UTF-8"?>

<odoo>

  <template id="assets_frontend" name="Custom Menu CSS" inherit_id="web.assets_frontend">

    <xpath expr="." position="inside">

      <link rel="stylesheet" type="text/css" href="/your_module/static/src/css/custom_menu.css"/>

    </xpath>

  </template>

</odoo>

Use web.assets_backend instead of web.assets_frontend if you want to style menus in the backend.

Update Manifest File ( __manifest__.py )
{

    'name': 'Custom Menu Styling',

    'version': '1.0',

    'depends': ['web', 'website'], # or just 'web' if it's backend

    'assets': {

        'web. assets_frontend': [

            'your_module/static/src/css/custom_menu.css',

        ],

    },

    'data': [

        'views/assets.xml',

    ],

    'installable': True,

    'application': False,

}

so create that custom module 

I hope it is usefull

頭像
捨棄