embed an image in ons-toolbar

Asked 4 months ago, Updated 4 months ago, 8 views

I'd like to embed an image in the ons-toolbar, but how can I embed it?
If you are familiar with this, please take good care of me.

monaca onsen-ui

2022-09-30 14:07

2 Answers

How about putting background-image: url('url') in the div tag?

<ons-toolbar>
    <div class="center" style="background-image:url('http://cdn.sstatic.net/ja/img/sprites.png?v=b55eefad6ab0')"></div>
    <div class="right">
      <ons-toolbar-button>
        <ons-iconion="ion-navicon" style="font-size:32px;width:1em">
      </ons-toolbar-button>
    </div>
  </ons-toolbar>


2022-09-30 14:07

You can also customize it with the modifier attribute.

<ons-toolbar modifier="hogehoge">
  <div class="center">Center Area</div>
</ons-toolbar>

The CSS specifies a class of navigation-bar--(modifier attribute value) for ons-toolbar.

.navigation-bar --hogehoge{
  background: url('http://placehold.jp/150x50.png') no-repeat center center;
}


2022-09-30 14:07

If you have any answers or tips


© 2023 OneMinuteCode. All rights reserved.