I'm struggling to find the variables to how you can change the colouring of the hollow buttons that foundation provides.
At the moment I have to override the styling by doing the below:
&.hollow {
border: 1px solid $clr-primary;
color: $clr-primary;
}
I like having to do most of my styling changes in the foundation settings file instead of taking this approach so I don't have to write more CSS than I need.
Is there a variable that I am missing that I can apply these stylings to in the foundation settings?
According the foundation wiki you find the variables here:
All Foundation projects include a settings file, named _settings.scss. If you're using the CLI to create a Foundation for Sites project, you can find the settings file under scss/ (basic template) or src/assets/scss/ (ZURB template). If you're installing the framework standalone using Bower or npm, there's a settings file included in those packages, which you can move into your own Sass files to work with.
— http://foundation.zurb.com/sites/docs/sass.html
Changing the color palette: http://foundation.zurb.com/sites/docs/global.html#changing-the-color-palette
Simply read-up on the ZURB Foundation SCSS Button MIXINS which are explained at the bottom of this page here >>
Here are a few SCSS examples:
div.pagenumber a.pagelink {
#include button($expand:false, $background:$primary-color, $background-hover:auto, $color:auto, $style:solid);
font-size: inherit;
padding: 0.5em;
margin: 0;
border-radius: $global-radius;
}
div.pagenumber a.pagelink:hover {
#include button($expand:false, $background:$primary-color, $background-hover:auto, $color:auto, $style:hollow);
text-decoration: none;
font-size: inherit;
padding: 0.5em;
margin: 0;
border-radius: $global-radius;
}
input.cancel {
#include breakpoint(small) {
#include button($expand:false, $background:$darkred, $background-hover:$crimson, $color:$white, $style:solid);
font-size: 0.85rem;
}
#include breakpoint(medium) {font-size: 0.95rem;}
#include breakpoint(large) {font-size: 1rem;}
}
Related
GIVEN that there is existing scss file that defines rules like .btn {..} or .btn-primary...
I WANT to declare my own rules by extending existing rules
.my-button {
#extend .btn
#extend .btn-primary
}
without actually including the .btn and .btn-primary classes in my generated css file?
Normally I need to #import exiting.scss, but that includes all the rules from the file in my css output.
Sass does not currently support this by default, neither with the #import nor #use rule.
Nonetheless, if you (can) use npm packages (npm / yarn) in your project, then node-sass-magic-importer may come in handy for you.
In your example, you could do the following:
#import '{ .btn, .btn-primary } from ~bootstrap';
.my-button {
#extend .btn
#extend .btn-primary
}
Note that the above will not do exactly what you desire – it will still import the other two classes though at least not the entire stylesheet. If you'd still like to go one step further, you could do:
#import '{ .btn as .my-button } from /bootstrap/_buttons.scss';
#import '[variables] from /bootstrap/_variables.scss';
#import '[mixins] from /bootstrap/mixins/_buttons.scss';
.my-button {
#include button-variant($btn-primary-color, $btn-primary-bg, $btn-primary-border);
}
I will recommend you to use #mixins and #include for this.
Although because as you said in your question, you are using an existing file (probably third party) that defines this rules. It may be tedious to turn the classes from this file into mixins.
so if you are going to use only a few classes from this file I recommend you to do that.
You will have to turn:
.btn{
/*
some cool styles
*/
}
into:
#mixin{
/*
cooler styles
*/
}
but still mixins as declared in the Sass documentation do exactly what you want.
source code SCSS:
#mixin reset-list {
margin: 0;
padding: 0;
list-style: none;
}
#mixin horizontal-list {
#include reset-list;
li {
display: inline-block;
margin: {
left: -2px;
right: 2em;
}
}
}
nav ul {
#include horizontal-list;
}
result CSS:
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav ul li {
display: inline-block;
margin-left: -2px;
margin-right: 2em;
}
when you import as #import in scss and when you do a production build the webpack dependancy graph will only include it once at the top level as it becomes a common chunk since you are using it in multiple places. Yes there is a side effect that unused scss is also included as there isn't much of tree shaking that is done.
Hence it should not affect the production build.
I'm currently following a tutorial that uses .scss but have decided to use .css instead. While I was following the tutorial I tried writing into the .css file but I ran into some compilation issues.
I'm not as familiar with .css so it was hard for me to fix them. I wasn't sure if the problem was with some of the syntax being exclusive to scss. The problem mainly lies in property-list-item.component.css and Property-list.component.css.
https://github.com/zhadjah9559/Wholesale-cli.git
Errors:
ERROR in ./src/app/property/Property-list-item/property-list-item.component.css
Module build failed: Error: Can't resolve 'variables' in 'C:\Users\zach\College\Spring 2019\Senior Proj\Wholesale-cli\src\app\property\Property-list-item'
at doResolve (C:\Users\zach\College\Spring 2019\Senior Proj\Wholesale-cli\node_modules\enhanced-resolve\lib\Resolver.js:180:19)
Pic1
pic 2
Also, does anyone know how to uninstall an extension? I believe i may be having a problem with one of the css formatter extensions i used in visual code.
UPDATE
#import 'variables';
a 6:hover,
a 6:focus {
text-decoration: none;
}
.bsp-card {
border: none;
}
.bsp-card .card-block {
padding-top: 8px;
}
.bsp-card .card-subtitle {
margin: 0px;
font-weight: 500;
font-size: 12px;
text-transform: uppercase;
color: #16861a;
}
.bsp-card .card-title {
font-size: 19px;
margin: 3px 0;
}
.bsp-card .card-text {
font-size: 14px;
font-weight: 300;
color: #7e7e7e;
margin-bottom: 0;
}
When you generate a new project you need to select CSS on generation like this
Your CSS file is trying to import a variables scss file that doesn't exist.
#import 'variables';
Remove that, but make sure there's no references to variables inside the css file.
I'm trying to change the style of the md-dialog.
in my main.scss i'm importing the prebuild pink-bluegrey theme...
then in my component I import the following -->
#import "#angular/material/dialog/dialog.scss";
$mat-dialog-padding: 0;
$mat-dialog-border-radius: 0.5rem;
$background: #ffffff;
#mixin mat-dialog-container {
padding: $mat-dialog-padding;
border-radius: $mat-dialog-border-radius;
background: $background;
}
#include mat-dialog-container;
The padding and border radius is correctly applied to the dialog window.
But the background is not working... also tried the !important statement.
I'm using this in a single component...
Is there also a change to apply those styles globally?
in chrome dev tools I see those applied style changes. The background gets overwritten by the pink-bluegrey theme..
hope anyone can help.
thanks
It is better practice to add a wrapper class around your dialog, and then add styling to the children. Have a look at this article for more information.
When you open your Angular dialog, you can add a panelClass
attribute, like this:
this.dialog.open(MyDialogComponent, {panelClass: 'my-panel'}).
then, in your css (e.g. in the root styles.css file), you can add the following:
.my-panel .mat-dialog-container {
overflow: hidden;
border-radius: 5px;
padding: 5px;
}
EDIT Warning
It is also possible to add the css to another file than the root styles.css, but then you have to use ::ng-deep in the css (e.g. ::ng-deep .my-panel{ // ... }). This is not advised, as ::ng-deep is deprecated in Angular
EDIT2 Good alternative
If you are using scss, then you can place your .my-panel-style in your mydialog.component.scss file, by using a #mixin, and #import the file in styles.scss. You can then use #include to load the defined mixin.
in your mydialog.component.scss file
#mixin myPanel(){
.my-panel .mat-dialog-container {
// css here
}
}
in your styles.scss
#import 'path/to/mydialog.component.scss' // you don't need the .scss suffix
#include myPanel();
I solved this problem by including this css block in the end of file material2-app-theme.scss
.mat-dialog-container {
overflow: hidden !important;
border-radius: 5px !important;
padding: 5px !important;
}
can you use css then change background in mat dilog, at i used color transparent
mat-dialog-container {
padding: 0px !important;
background: transparent !important;
}
I have a Gtk app I'm releasing for windows and I'm trying to do a little bit of syle via css. I put the following css (for tesing) in MYAPP\etc\gtk-3.0\gtk.css but nothing changes.
*
{
background-color: #FF0000;
color: #00FF00;
}
GtkMenuItem
{
color: #FF0000;
margin: 5px;
}
GtkTextView
{
background-color: #000000;
}
Is the file in the wrong location?
Yes, the location is wrong.
According to the documentation you should save it under datadir/share/themes/theme-name/gtk-3.0/gtk.css that, on Windows and supposing you are using the standard Adwaita theme, should be YOURAPP\share\themes\Adwaita\gtk-3.0\gtk.css.
I'm trying to get Blueprint (SCSS-Syntax) working with my Rails (3.1) project.
To keep it simple at first I set up a plain HTML file (outside my rails project) with some basic blueprint syntax, after installing compass and creating the basic scss files with:
compass install blueprint .
It produces a sass directory with a screen.scss that contains:
#import blueprint
among other stuff, but the stylesheets/screen.css doesn't contain span-x instructions, as I was expecting after watching Compass: A Real Stylesheet Framework by Chris Eppstein (http://vimeo.com/4335944) and most importantly my HTML is looking dull as ever.
<html>
<head>
<link href="stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css" />
<link href="stylesheets/print.css" media="print" rel="stylesheet" type="text/css" />
<!--[if lt IE 8]>
<link href="/stylesheets/ie.css" media="screen, projection" rel="stylesheet" type="text/css" />
<![endif]-->
</head>
<body>
<div class="container">
<div class="span-24">
<center>
<h1 class="alt box">asdfhlakshf sdfgs dgf sdf sdfg fsd g</h1>
</center>
</div>
<div class="pre">
asdfhlakshf
</div>
<div class="span-4 success colborder">
WOW
</div>
</div>
</body>
</html>
My screen.css looks like this (small excerpt):
/* line 44, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.11.5/frameworks/blueprint/stylesheets/blueprint/_form.scss */
form.bp input.text, form.bp input.title, form.bp input[type=email], form.bp input[type=text], form.bp input[type=password] {
width: 300px;
}
/* line 46, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.11.5/frameworks/blueprint/stylesheets/blueprint/_form.scss */
form.bp textarea {
width: 390px;
height: 250px;
}
/* line 39, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.11.5/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss */
form.bp .box {
padding: 1.5em;
margin-bottom: 1.5em;
background: #e5ecf9;
}
/* line 42, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.11.5/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss */
form.bp .border {
padding-right: 4px;
margin-right: 5px;
border-right: 1px solid #dddddd;
}
/* line 45, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.11.5/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss */
form.bp .colborder {
padding-right: 24px;
margin-right: 25px;
border-right: 1px solid #dddddd;
}
/* line 47, ../../../../../Library/Ruby/Gems/1.8/gems/compass-0.11.5/frameworks/blueprint/stylesheets/blueprint/_scaffolding.scss */
form.bp hr {
background: #dddddd;
color: #dddddd;
clear: both;
float: none;
width: 100%;
height: 0.1em;
margin: 0 0 1.45em;
border: none;
}
Calling
compass compile
Just tells me everything stays unchanged. But it does something once I add
#import "blueprint/grid"
for example. Still no pretty html though.
The second I copy a precompiled screen.css (downloaded from the blueprint website) to the stylesheets folder everything works like a charm. It's the same inside of my rails project. I can use the precompiled css there without problems.
I guess I'm missing something basic here I need to do for the compass compiling magic to work, but I can't figure out what it is.
Thanks in advance for any ideas!
Versions
compass 0.11.5 (Antares)
ruby 1.8.7 (outside of the rails project)
ruby 1.9.2 (with the rails project)
using rvm 1.6.21
Installed haml 3.1.2 and sass 3.1.4. Though I think that this should not be relevant since I used html and scss, right?
Maybe I should have included more of my screen.scss:
// This import applies a global reset to any page that imports this stylesheet.
#import "blueprint/reset";
// To configure blueprint, edit the partials/base.sass file.
#import "partials/base";
#import "blueprint/grid";
// Import all the default blueprint modules so that we can access their mixins.
#import "blueprint";
// Import the non-default scaffolding module.
#import "blueprint/scaffolding";
// To generate css equivalent to the blueprint css but with your
// configuration applied, uncomment:
// #include blueprint
// If you are doing a lot of stylesheet concatenation, it is suggested
// that you scope your blueprint styles, so that you can better control
// what pages use blueprint when stylesheets are concatenated together.
body.bp {
#include blueprint-typography(true);
#include blueprint-utilities;
#include blueprint-debug;
#include blueprint-interaction;
// Remove the scaffolding when you're ready to start doing visual design.
// Or leave it in if you're happy with how blueprint looks out-of-the-box
}
form.bp {
#include blueprint-form;
// You'll probably want to remove the scaffolding once you start styling your site.
#include blueprint-scaffolding; }
// Page layout can be done using mixins applied to your semantic classes and IDs:
body.two-col {
#container {
#include container; }
#header, #footer {
#include column($blueprint-grid-columns); }
#sidebar {
// One third of the grid columns, rounding down. With 24 cols, this is 8.
$sidebar-columns: floor($blueprint-grid-columns / 3);
#include column($sidebar-columns); }
#content {
// Two thirds of the grid columns, rounding up.
// With 24 cols, this is 16.
$content-columns: ceil(2 * $blueprint-grid-columns / 3);
// true means it's the last column in the row
#include column($content-columns, true); } }
I also tried changing my ruby version and renaming the sass folder to scss. I'm running out of ideas here...
Alright. It was something basic. I didn't uncomment the "#include blueprint" line, because I thought #import blueprint should be enough and I go an error message, when I tried.
Turns out the error message was solved by adding a semicolon to the end of the line.
Maybe the smicolon should be added in the shipped screen.scss. I'll send an email to the author.