斜角小吃栏中的中心文本

时间:2018-06-19 21:03:38

标签: angular angular5 angular-material2

在斜角小吃栏中将文本居中的正确方法是什么?

我已经尝试过了,但是没用:

let config = new MatSnackBarConfig();
config.panelClass = 'center';
this.snackBar.open(message, undefined, config);

,然后在某些CSS文件中(相同的组件或全局文件中):

.center {
   justify-content: center;
}

4 个答案:

答案 0 :(得分:1)

您可以使用open()panelClass来做到这一点,但是您需要修改CSS:

.center > .mat-simple-snackbar {
  justify-content: center;
}

答案 1 :(得分:0)

panelClass参数对我有用。 StackBiltz here

改为使用text-align: center

答案 2 :(得分:0)

import sys
import urllib
import bs4 as bs
from tkinter import *
from tkinter import ttk
import threading
gm =('ADMINS')
root = Tk(className='Status')
v = StringVar()
v.set('-')
style = ttk.Style()
style.configure("red.TLabel", foreground = "red")
label = ttk.Label(root, textvariable=v, style = "red.TLabel")
label.pack()
#print(v.get())


def check():
    link = 'https://www.daemu.cz/zebricky/online/'
    request = urllib.request.Request(
        link, headers={'User-Agent': 'Mozilla/5.0'})
    source = urllib.request.urlopen(request).read()
    #pocet_na_webpage = re.search('je online (.+?) ', str(source)).group(1)
    #df_table = pd.read_html(source)[0]
    soup = bs.BeautifulSoup(source, "lxml")
    table = soup.table
    #filtering = df_table.filter(items=[0,1,3,6])
    table_rows = table.find_all('tr')
    for tr in table_rows:
        td = tr.find_all('td')
        row = [i.text for i in td]
        #print(row)
        if str(gm) in str(row) and v.get() == ('-'):
            v.set('GM je ONLINE!')
            break
        elif str(gm) not in str(row) and v.get() == ('GM je ONLINE!'):
            v.set('-')
        #print(v.get())


def repeat():
    thread = threading.Timer(10, repeat)
    try:
        check()
        thread.start()
        root.update()
    except KeyboardInterrupt:
        root.destroy()
        thread.cancel()
        pass
    pass

repeat()
root.call('wm', 'attributes', '.', '-topmost', '1')
root.mainloop()

答案 3 :(得分:0)

除了材料指南,它还适用于我们的软件产品:

.mat-snack-bar-container {
    text-align: center;
}

.mat-simple-snackbar {
    display: inline-block !important;
}