css不适用于使用sass和bootstrap的按钮

时间:2018-10-12 06:04:41

标签: html css sass bootstrap-4

我正在使用sass和Bootstrap 4进入页面,但是没有应用css

我的文件夹结构:

scss 
   styles.scss
   styles.css
   styles.css.map
node_modules 
   all sass n bootstrap files
layout.html
package-lock

在我的styles.scss中,我有以下内容:

$primary: #3498db;
$secondary: #e67e22;
$success: #2eeeff;
$danger: #e74c3c;

@import "../node_modules/bootstrap/scss/bootstrap.scss";

/*# sourceMappingURL=styles.css.map */

在我的版式上,我有:

<link href="scss/styles.scss" rel="stylesheet" />

<link href="scss/styles.css" rel="stylesheet" />

我的按钮代码:

<div class="col-md-auto col-4">
   <button class="btn btn-lg btn-primary mr-1">Primary</button>
</div>
<div class="col-md-auto col-4">
   <button class="btn btn-lg .btn-success">Primary Outline</button>
</div>
<div class="col-md-auto col-4">
   <button class="btn btn-lg .btn-danger">Primary Active</button>
</div>

但是我的styles.scss并没有应用于我的任何按钮。

如果我使用:

<link href="scss/styles.css" rel="stylesheet" />

然后,它仅应用Bootstrap,而不应用.scss样式。感谢您的帮助,请让我知道我要去哪里了。

1 个答案:

答案 0 :(得分:-1)

感谢大家的大力帮助 以下工作欢呼声:)

import tkinter as tk 
import os  
from tkinter import * 
from tkinter.messagebox import *
from tkinter.filedialog import *

class Kladblok:
    __root = Tk()

    __thisBreedte = 300
    __thisHoogte = 300
    __thisTekstVlak = Text(__root) 
    __thisMenuBar = Menu(__root) 
    __thisBestandMenu = Menu(__thisMenuBar, tearoff=0) 
    __thisBewerkenMenu = Menu(__thisMenuBar, tearoff=0)
    __thisOpmaakMenu = Menu(__thisMenuBar, tearoff=0)
    __thisHelpMenu = Menu(__thisMenuBar, tearoff=0) 
    __thisScrollBar = Scrollbar(__thisTekstVlak)      
    __bestand = None

    def __init__(self,**kwargs): 

        try: 
            self.__root.wm_iconbitmap("Notepad.ico")  
        except: 
            pass

        try: 
            self.__thisBreedte = kwargs['breedte'] 
        except KeyError: 
            pass

        try: 
            self.__thisHoogte = kwargs['hoogte'] 
        except KeyError: 
            pass

        self.__root.title("Naamloos - Kladblok") 

        screenBreedte = self.__root.winfo_screenwidth() 
        screenHoogte = self.__root.winfo_screenheight() 

        links = (screenBreedte / 2) - (self.__thisBreedte / 2)  

        top = (screenHoogte / 2) - (self.__thisHoogte /2)  

        self.__root.geometry('%dx%d+%d+%d' % (self.__thisBreedte, self.__thisHoogte, links, top))  

        self.__root.grid_rowconfigure(0, weight=1) 
        self.__root.grid_columnconfigure(0, weight=1) 

        self.__thisTekstVlak.grid(sticky = N + E + S + W)

        self.__thisBestandMenu.add_command(label="Nieuw", command=self.__nieuwBestand) 

        self.__thisBestandMenu.add_command(label="Open", command=self.__openBestand) 

        self.__thisBestandMenu.add_command(label="Opslaan", command=self.__opslaanBestand)

        self.__thisBestandMenu.add_separator()                                          
        self.__thisBestandMenu.add_command(label="Exit", command=self.__exitBestand) 
        self.__thisMenuBar.add_cascade(label="Bestand", menu=self.__thisBestandMenu)

        self.__thisOpmaakMenu.add_command(label="Lettergrootte", command=self.__opmaak)

        self.__thisMenuBar.add_cascade(label="Opmaak", menu=self.__thisOpmaakMenu)

        self.__thisBewerkenMenu.add_command(label="Knippen", command=self.__knippen)              

        self.__thisBewerkenMenu.add_command(label="Kopieren", command=self.__kopieeren)          

        self.__thisBewerkenMenu.add_command(label="Plakken", command=self.__plakken)          

        self.__thisMenuBar.add_cascade(label="Bewerken", menu=self.__thisBewerkenMenu)    

        self.__thisHelpMenu.add_command(label="Over mij", command=self.__overMij)
        self.__thisMenuBar.add_cascade(label="Help mij", menu=self.__thisHelpMenu) 

        self.__root.config(menu=self.__thisMenuBar) 

        self.__thisScrollBar.pack(side=RIGHT,fill=Y)                     

        # Scrollbar will adjust automatically according to the content         
        self.__thisScrollBar.config(command=self.__thisTekstVlak.yview)      
        self.__thisTekstVlak.config(yscrollcommand=self.__thisScrollBar.set) 

    def __exitBestand(self): 
        self.__root.destroy()

    def __nieuwBestand(self): 
        self.__root.title("Naamloos - Kladblok") 
        self.__bestand = None
        self.__thisTekstVlak.delete(1.0,END) 

    def __openBestand(self): 

        self.__bestand = askopenfilename(defaultextension=".txt", filetypes=[("Alle bestanden","*.*"), ("Tekst bestanden","*.txt")]) 

        if self.__bestand == "": 
            self.__bestand = None

        else: 
            self.__root.title(os.path.basename(self.__bestand) + " - Kladblok") 
            self.__thisTekstVlak.delete(1.0,END) 

            bestand = open(self.__bestand,"r") 

            self.__thisTekstVlak.insert(1.0,bestand.read()) 

            bestand.close() 

    def __opslaanBestand(self):
        if self.__bestand == None: 
            self.__bestand = asksaveasfilename(initialfile='Naamloos.txt', defaultextension=".txt", filetypes=[("Alle bestanden","*.*"), ("Tekst bestanden","*.txt")]) 

            if self.__bestand == "": 
                self.__bestand = None

            else: 
                bestand = open(self.__bestand,"w") 
                bestand.write(self.__thisTekstVlak.get(1.0,END)) 
                bestand.close() 

                self.__root.title(os.path.basename(self.__bestand) + " - Kladblok") 

        else: 
            bestand = open(self.__bestand,"w") 
            bestand.write(self.__thisTekstVlak.get(1.0,END)) 
            bestand.close() 

    def __knippen(self): 
        self.__thisTekstVlak.event_generate("<<Cut>>") 

    def __kopieeren(self): 
        self.__thisTekstVlak.event_generate("<<Copy>>") 

    def __plakken(self): 
        self.__thisTekstVlak.event_generate("<<Paste>>")    

    def __overMij(self):
        showinfo("Kladblok", "Copyright Timbo") 

    def __nieuweFont(self, *args):
        nieuweFont = (font.get(), fontSize.get())
        open['font'] = nieuweFont
        return nieuweFont

    def __opmaak(self, nieuweFont):
        font = StringVar(self.__root)
        font.set("Times")
        font.trace("w", nieuweFont)
        fontOptions = OptionMenu(self.__root, font, "Arial", "Times", "Helvetica", "Comic")

    #start programma
    def start(self): 
        self.__root.mainloop()

kladblok = Kladblok(width=600,height=400) 
kladblok.start()