I hope somebody can help me with my question.
Lets say I have this:
<div class="container">
<div class="row">
<article>
<p class="story-image">
<a href="#">
<img src="../media/images/awesomeness.jpg" alt="image1" class="img-responsive">
</a>
</p>
<section>
<h3>Companies</h3>
<h2>
<a href="#">
Awesome-O beherrscht die Welt
</a>
</h2>
<p>
Last year, was pretty medium. But I know, by the power of my thought and my willpower, that I will make two companies and earn millions.
</p>
</section>
</article>
</div>
</div>
So, when using Twitter Bootstrap, I can apply the grid system to my HTML. Is it possible by using sass to apply a class to the article, even if it wasn't applied in the HTML from the beginning?
for example somehow like this:
html{
body {
article {
addclass --> col-lg-4 col-md-4 col-sm-6 col-xs-12;
}
}
}
The reason I want to do it afterwards with sass, is that I have a bunch of articles, And I have to apply the grid system on them. But I am sure that I am going to revealuate at a later point the actual width and the ammount of the columns.
Is this possible with Sass and if yes, how?
You can not "attach" a SASS/SCSS file to an HTML document. SASS/SCSS is a CSS preprocessor that runs on the server and compiles to CSS code that your browser understands.
Add the following to the <head> tag of your HTML file. The extension we installed will compile the SASS file index. scss into CSS and store the compiled code in a new CSS file, also called index. css .
When you write Sass code in a . scss file, it is compiled into a regular CSS file that the browser will use to display it on the web page.
No. You can't add classes to HTML through CSS. You could look into using @extend
though.
For example:
%grid-half {
width: 50%;
}
.article {
@extend %grid-half;
color: purple;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With