html - 使用css强制将 ionic View 标题对齐到中心

标签 html css ionic-framework

我正在尝试使用 CSS 将 ionic View 与中心对齐。这是我的代码

CSS

/*pull the title to the center*/
.pullCenter title{
text-align:center;
}

ionic HTML

<ion-view class="pullCenter" title="Please Login">

这是图像结果 enter image description here

但它永远不会与中心对齐。请问有什么问题吗?

最佳答案

将此添加到您的 .config

示例代码:

ionicApp.config(function($stateProvider, $urlRouterProvider, $ionicConfigProvider) {

    $ionicConfigProvider.navBar.alignTitle('center')
});

尝试在标记

中添加align-title="center"

喜欢

<ion-view class="pullCenter" title="Please Login" align-title="center">

希望对您有所帮助。

关于html - 使用css强制将 ionic View 标题对齐到中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36357155/

相关文章:

javascript - 滚动到 anchor 并固定导航

javascript - 为什么 element.style 在 JS 中总是返回空?

html - Bootstrap navbar-collapsed 缩小后不保留背景

javascript - 单击链接更改内容

javascript - getCurrentPosition 不适用于 angularjs

angular - 如何阻止构造函数内部的异步回调进行测试?

javascript - 如何使用 javascript 将内容传递到新页面?

html 直接链接下载不适用于不同的文件编码

html - 空间均匀(对齐内容)不适用于 Chrome 移动版

javascript - 类型 'url' 上不存在属性类型 'Event'