Using icon/image that was imported in a seperate SCSS file - sass

I need to use a magnifying glass icon in the left of an input field, problem is that all of the icons are imported in a separate SCSS file. How can I use these icons in the search field?
The start of the icons.scss file:
#font-face {
font-family: "app";
src:url("../fonts/app.eot");
src:url("../fonts/app.eot?#iefix") format("embedded-opentype"),
url("../fonts/app.woff2") format("woff2"),
url("../fonts/app.woff") format("woff"),
url("../fonts/app.ttf") format("truetype"),
url("../fonts/app.svg#app") format("svg");
font-weight: normal;
font-style: normal;
}
[data-icon]:before {
font-family: "app" !important;
content: attr(data-icon);
font-style: normal !important;
font-weight: normal !important;
font-variant: normal !important;
text-transform: none !important;
speak: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
[class^="icon-"]:before,
[class*=" icon-"]:before {
font-family: "app" !important;
font-style: normal !important;
font-weight: normal !important;
font-variant: normal !important;
text-transform: none !important;
speak: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
And the Icon from the file that i want to use:
.icon-search:before{
content: "\43";
}
The search SCSS that i want to use the icon in:
.search-div{
padding: 8px 5px;
border-bottom: 0.5px solid rgba(0, 0, 0, 0.12);
overflow: hidden;
.ato-search-bar{
//Code here for the background icon
}
}
I have imported the icons scss into my other file, but not sure where to go from there.

You need to use the #extend directive. That means that you will extend your selector with some other selector properties. The extended class will have all the properties of the original class. The #extend directive will alsi extends all the defined pseudo selectors.
// In your icons.scss file
.icon-search:before{
content: "\43";
}
// Later in you css (remember to import icons.scss using: #import "icons";
.search-div{
padding: 8px 5px;
border-bottom: 0.5px solid rgba(0, 0, 0, 0.12);
overflow: hidden;
.ato-search-bar{
#extend .icon-search; // Extends the icon class
}
}
Will compile into:
.icon-search:before,
.search-div .ato-search-bar:before {
content: "\43";
}
.search-div {
padding: 8px 5px;
border-bottom: 0.5px solid rgba(0, 0, 0, 0.12);
overflow: hidden;
}
Hope it helps.

Related

Sass: possible to create the selector like ".namespace-blockA+.namespace-blockB" while declaring "namespace-blockB"?

We need to declare the top margin for .Article-UnorderedList when it goes after .Article-Paragraph.
We can write selector .Article-Paragraph+.Article-UnorderedList, but it is not suites with below code (in comments, I wrote why).
.Article
&-Paragraph
font-size: 16px
line-height: 18px
// In this line, we don't not know about ".Article-UnorderedList" yet.
// There could be a lot of unknown at advance selectors like ".Article-UnorderedList" below.
// So, we can't write "&.+Article-UnorderedList" here.
// Article-UnorderedList declaration begins here. Now we know about it and also about ".Article-Paragraph"
// So, this selector MUST know how to shift from ".Article-Paragraph"
&-UnorderedList
list-style-type: disc
list-style-position: outside
padding-left: 20px
>li
line-height: 18px
&:not(:first-child)
margin-top: 4px
// We need to declare the margin from .Article-Paragraph
// Some way to create .Article-Paragraph+.Article-UnorderedList HERE?
// Works but lame: we need to exit from &-UnorderedList level and re-declare styles
// for .Article-Paragraph
&-Paragraph+.Article-UnorderedList
margin-top: 16px
You could set a global variable in your parent selector and then use it in your UnorderedList element.
.Article
&-Paragraph
$parent: & !global
font-size: 16px
line-height: 18px
&-UnorderedList
list-style-type: disc
list-style-position: outside
padding-left: 20px
>li
line-height: 18px
&:not(:first-child)
margin-top: 4px
#{$parent} + &
margin-top: 16px
Your result:
.Article-Paragraph {
font-size: 16px;
line-height: 18px;
}
.Article-UnorderedList {
list-style-type: disc;
list-style-position: outside;
padding-left: 20px;
}
.Article-UnorderedList > li {
line-height: 18px;
}
.Article-UnorderedList > li:not(:first-child) {
margin-top: 4px;
}
.Article-Paragraph + .Article-UnorderedList {
margin-top: 16px;
}

Font Awesome - Utensils icon not working with Shortcode

Im using Font Awesome CDN with Joomla and Helix Ultimate framework. Im trying to implement some icons to my navigation, using the shortcodes. For any reason the "utensils" icon is not working - but its implemented in the freeware. Here is my css:
ul.sp-mega-group li.item-189 a:before{
font-family: 'FontAwesome' !important;
content: '\f017' !important;
font-size: 50px;
color: #5A1F00;
padding-top: 20px !important;
}
ul.sp-mega-group li.item-195 a:before{
font-family: 'FontAwesome' !important;
content: '\f128' !important;
font-size: 50px;
color: #5A1F00;
padding-top: 20px !important;
}
ul.sp-mega-group li.item-196 a:before{
font-family: 'FontAwesome' !important;
content: '\f2e7' !important;
font-size: 50px;
color: #5A1F00;
padding-top: 20px !important;
}
ul.sp-mega-group li.item-197 a:before{
font-family: 'FontAwesome' !important;
content: '\f279' !important;
font-size: 50px;
color: #5A1F00;
padding-top: 20px !important;
}
The other free icons are working. When I`m using an other shortcode für this menulink its working too, so the problem should be the icon itself. Here is a link to the site, the submenu items under "Parkinfos" is the problem.
Hope someone can tell me whats wrong here.
kweb
That icon is not available in 4.7.0, you will need to upgrade to version 5 for that to be available. If you check the icon page here, you will see it was added in version 5. The nearest icon available in your version is 'cutlery' so you can use:
content: '\f0f5' !important;
Also, consider tidying up your CSS:
ul.sp-mega-group li a:before{
font-family: 'FontAwesome' !important;
font-size: 50px;
color: #5A1F00;
padding-top: 20px !important;
}
Then you only need to add the content style to each menu item.

SASS, #import and make it abstract

Is there any way to #import a file and make all the classe it contains abstract ?
Let me show an example to explain :
#import "bootstrap"; //Do something magic to make all classes abstract
.my-bem__custom{
#extend .btn
}
It should output a css file this way :
//Not any bootstrap stuff here
.my-bem__custom {
display: inline-block;
margin-bottom: 0;
font-weight: normal;
text-align: center;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
background-image: none;
border: 1px solid transparent;
white-space: nowrap;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
border-radius: 4px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
No. Sass has nothing like that. If it did, it would be referenced in the documentation.

Fancybox and Chrome / Firefox

i got a "little" bug on my website. Here is the code im using:
product.tpl
{else}
href="{$link->getImageLink($product->link_rewrite, $imageIds, 'thickbox_default')|escape:'html':'UTF-8'}"
data-fancybox-group="other-views"
class="fancybox{if $image.id_image == $cover.id_image} shown{/if}"
global.css
.fancybox-skin {
background: #f4f5f7 !important; }
.fancybox-skin .fancybox-close {
width: 28px;
height: 28px;
background: none;
font-size: 28px;
line-height: 28px;
color: #333333;
text-align: center;
background: #f4f5f7!important;
-webkit-border-radius: 50px;
-moz-border-radius: 50px;
border-radius: 50px; }
.fancybox-skin .fancybox-close:hover {
color: #515151; }
.fancybox-skin .fancybox-close:after {
content: "\f057";
font-family: "FontAwesome"; }
Here is a Link to a product.
If you enlarge the picture by clicking on it, and hover to one of the sites and than jump to one of the other pictures you can see that the background is moving. In Internet Explorer it is working fine.
Now:
/* 1920x1200 ----------- */
#media only screen
and (min-width : 1681px) {
/* Styles */
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
line-height: 1.42857;
background: #f4f5f7 url('http://evoxity.net/themes/default-bootstrap/img/background/1920x1200.jpg');
margin: 0 ;
background-repeat: no-repeat scroll;
-moz-background-size:cover;
overflow: auto;
background-position:center 0;
}
}

Recreating the look and feel of WP7 Metro UI using CSS3, HTML5 and Javascript

Are there any examples out there that can create/recreate the common Metro UI controls using CSS/javascript/HTML5 for Windows Phone 7?
Shameless plug: https://github.com/ace-subido/css3-microsoft-metro-buttons try using this CSS/JS library for metro-buttons :)
Yes, there are some simple examples here:
Developing Windows Phone 7 HTML5 apps with PhoneGap
Try the following to get you started:
body, input, div, span
{
font-size: 20px;
color: white;
font-family: Segoe WP, Sans-Serif;
}
body
{
background:black;
margin:0;
padding:0;
}
h2
{
font-weight: normal;
font-size: 32px; /* PhoneFontSizeLarge */
}
h1
{
font-weight: normal;
font-size: 42.667px; /* PhoneFontSizeExtraLarge */
}
button
{
background: black;
color: white;
border: 3px solid white; /* PhoneBorderThickness */
padding: 6px 10px;
font-size: 25.333px; /* PhoneFontSizeMediumLarge */
position: relative;
top: -4px;
}
button:active
{
background: white;
color: black;
}
button:disabled
{
opacity: 0.7;
}
input[type="text"]
{
font-size: 25.333px; /* PhoneFontSizeMediumLarge */
width: 200px;
padding: 6px;
height: 31px;
border: 3px solid white;
color: black;
}
input[type="checkbox"]
{
width: 32px;
height: 32px;
vertical-align: middle;
}

Resources