<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Jean Tiston</title>
    <description>The latest articles on Forem by Jean Tiston (@jeantiston).</description>
    <link>https://forem.com/jeantiston</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F373208%2F161f1cc5-1143-4825-b4aa-30a110b90078.png</url>
      <title>Forem: Jean Tiston</title>
      <link>https://forem.com/jeantiston</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jeantiston"/>
    <language>en</language>
    <item>
      <title>4 Things I've Learned While Creating My Style Stage Stylesheet</title>
      <dc:creator>Jean Tiston</dc:creator>
      <pubDate>Fri, 17 Jul 2020 14:15:57 +0000</pubDate>
      <link>https://forem.com/jeantiston/4-things-i-ve-learned-while-creating-my-style-stage-stylesheet-4pjb</link>
      <guid>https://forem.com/jeantiston/4-things-i-ve-learned-while-creating-my-style-stage-stylesheet-4pjb</guid>
      <description>&lt;p&gt;I'm relatively new to frontend web development and while courses are wonderful wells of knowledge in learning web dev, nothing beats hands-on practice in sharpening your skills. When I saw &lt;a href="https://dev.to/5t3ph/call-for-contributors-show-off-and-improve-your-css-skills-5d6g"&gt;Stephanie Eckles' Call for Contribution for Style Stage&lt;/a&gt; last July 6 I immediately sent her a message to say that I'm interested to contribute even if I wasn't sure if I'm gonna make it on time for the launch deadline. (Spoiler alert: I did make it)&lt;/p&gt;

&lt;h2&gt;
  
  
  Style Stage
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://stylestage.dev/"&gt;Style Stage&lt;/a&gt; is a modern CSS showcase styled by community contributors. Basically, anybody can submit a CSS stylesheet for the site. You'll have access to the semantic HTML but you can't change it and you'll also have to abide by the guidelines in the site which includes responsive design and accessibility. &lt;/p&gt;

&lt;p&gt;It was fun and a bit challenging to create a stylesheet when you can't change the HTML. Here are the 4 things I learned during the process:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. CSS Variables
&lt;/h2&gt;

&lt;p&gt;I've known CSS variables before but it's one of those things that I've never really used. But when I saw how organized the sample Style Stage stylesheet was because of CSS variables I decided to give it a go.&lt;/p&gt;

&lt;p&gt;I used it to declare variables for my color palette, font, and border style. You declare a CSS variable with a double dash (--) and it's usually declared at the root so you'll have access to it throughout the stylesheet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;:root {
  --aquamarine: #4dbda7;
  --light-gray: #d9d9d9;
  --black: #2d2721;
  --font-primary: "Bungee Shade", serif;
  --font-secondary: "Montserrat", sans-serif;
  --font-weight-strong: 700;
  --font-size-h1: 6rem;
  --font-size-h2: 3rem;
  --font-size-text: 1.15rem;
  --border-radius: 8px; 

}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And this is how you use it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;body {
    background-color: var(--light-gray);
    color: var(--black);
    font-family: var(--font-secondary); 
    }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;No more memorizing hex codes for colors.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. CSS Selector Combinators
&lt;/h2&gt;

&lt;p&gt;Of course, we all know the basic selectors like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.class {}
#id {}
element {}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;When you have control over the HTML, it's so easy to throw in an extra wrapper div and add an id or class to control the style. In Style Stage, you can't edit the HTML since all contributions are using the same one. &lt;/p&gt;

&lt;p&gt;Even if the HTML for Style Stage has been semantically written and IDs and classes were added on key parts to help with styling, you might need to use &lt;a href="https://www.w3schools.com/cssref/css_selectors.asp"&gt;CSS combinators&lt;/a&gt; to target specific elements.&lt;/p&gt;

&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;section.container {   //selects section with class="container"
        grid-template-columns: 1fr 1fr 1fr;
    }

    section &amp;gt; * {   //selects all children of section
        grid-column: 2 / -1;
    }

    section p {   //selects all &amp;lt;p&amp;gt; inside &amp;lt;section&amp;gt; elements
        text-align: left;
        padding: 0 60px;
    }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  3. Clamp
&lt;/h2&gt;

&lt;p&gt;This has been a question of mine since I started: How can I make font sizes responsive?&lt;/p&gt;

&lt;p&gt;I thought I can use viewport relative sizes like vh/vw. You technically can but it doesn't really resize very well in certain dimensions. And then I found clamp() and it is the perfect solution!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;h1 {
    font-size: var(7rem);
    font-size: clamp(2rem, 7vw, 7rem); 
}

//clamp(MIN, VAL, MAX)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The first value is the minimum. The val at the middle should always be a relative size. And the last one is the maximum size.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note that clamp is not yet supported in some browsers so make sure to consider that when using it and have a fallback.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Embed Fonts in CSS
&lt;/h2&gt;

&lt;p&gt;I always embed fonts in my HTML file so before this I didn't know I can do it in CSS.&lt;/p&gt;

&lt;p&gt;There are two ways you can do it: First is using @font-face. You have to generate and host your own webfont to do this. I tried it but I scrapped it when it was time to upload it in GitHub. For some reason, when I was trying to replace the path with an absolute URL of the font, it was not working. I probably did not use the raw URL.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@font-face {
  font-family: 'bungee_shaderegular';
  src: url('bungeeshade-regular-webfont.woff2') format('woff2'),
       url('bungeeshade-regular-webfont.woff') format('woff');
  font-weight: normal;
  font-style: normal;

}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The easier method and what I should have done in the first place is to use @import which is readily available in Google Fonts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@import url('https://fonts.googleapis.com/css2?family=Bungee+Shade&amp;amp;family=Montserrat&amp;amp;display=swap');
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h1&gt;
  
  
  In Summary
&lt;/h1&gt;

&lt;p&gt;Overall, it's an excellent experience immersing myself in modern CSS through this project. &lt;a href="https://dev.to/5t3ph/announcing-style-stage-a-community-css-showcase-28cp"&gt;Style Stage has been launched&lt;/a&gt; last July 10, 2020. The one day I spent hacking the stylesheet was well-spent cause I became one of the first six contributors. &lt;/p&gt;

&lt;p&gt;Whether you're a newbie who is still learning the ropes or an expert who wants to show off your CSS skills or anyone in between, definitely consider contributing to Style Stage. &lt;/p&gt;

&lt;h2&gt;
  
  
  Retroish
&lt;/h2&gt;

&lt;p&gt;Check out Style Stage dressed in the simple responsive style I've made called &lt;a href="https://stylestage.moderncss.dev/styles/retroish/"&gt;Retroish&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>css</category>
      <category>beginners</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>When should I use percent/vh/vw and fixed pixel sizes?</title>
      <dc:creator>Jean Tiston</dc:creator>
      <pubDate>Thu, 02 Jul 2020 10:58:15 +0000</pubDate>
      <link>https://forem.com/jeantiston/when-should-i-use-percent-vh-vw-and-fixed-pixel-sizes-254g</link>
      <guid>https://forem.com/jeantiston/when-should-i-use-percent-vh-vw-and-fixed-pixel-sizes-254g</guid>
      <description>&lt;p&gt;A bit of a background on why I am asking this. So I was doing a frontend coding challenge at &lt;a href="https://www.frontendmentor.io/profile/jeantiston"&gt;Frontend Mentor&lt;/a&gt; that is a Testimonial Page Slider. So mainly it has a portrait image and a testimonial quote.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Q9jSCH_H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dl.dropboxusercontent.com/s/gmbz9nidm5gt20t/desktop2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Q9jSCH_H--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dl.dropboxusercontent.com/s/gmbz9nidm5gt20t/desktop2.png" alt="Desktop screenshot of testimonial slider"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Besides using breakpoints, I tried to make my design more responsive by using percent/vh/vw in some of the sizes. One example of that is for the size of the main image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.photo {
    width: 70vw;
    height: auto;
    border-radius: 10px;
    box-shadow: 20px 20px 50px rgba(0,0,0,0.3);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;and the slider arrow navigation which is supposed to be positioned at the bottom part of the image:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.nav {
    display: float;
    position: absolute;
    left: 40%;
    top: 85%;
    padding: 13px 10px;
    background-color: white;
    border-radius: 50px;
    box-shadow: 20px 20px 50px rgba(0,0,0,0.3);
    cursor: pointer;

}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;But as one of the feedback I have gotten pointed out, the text and image proportion is not very good when it gets at 460px to 600px. The slider arrow navigation also gets displaced at some point. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--k6bGE4Bk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dl.dropboxusercontent.com/s/cds4ifgz62j81kl/screencap.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--k6bGE4Bk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dl.dropboxusercontent.com/s/cds4ifgz62j81kl/screencap.gif" alt="Screencap of breaking layout"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;She suggested that I just use a fixed size for the image and I think that's true in this case.&lt;/p&gt;

&lt;p&gt;So back to the question: **when do I know that it's better to use percent/vw/vh in my design and when to use fixed pixel sizes?&lt;/p&gt;

&lt;p&gt;Can I also use percent/vh/vw for font sizes? And if yes, does it make sense to do so? And when, if ever, should I do that?**&lt;/p&gt;

&lt;p&gt;If you want to scrutinize the page further &lt;a href="https://coding-bootcamp-testimonials-slider-master-brown.vercel.app/"&gt;here is the live site&lt;/a&gt;. If you want to see the code you can probably just inspect the page but in case you want &lt;a href="https://github.com/jeantiston/coding-bootcamp-testimonials-slider-master"&gt;the repo here it is&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;I'm quite new with this frontend thing and so I'd really appreciate if you'd point me to a few resources I can refer to when I have these kind of questions.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>discuss</category>
      <category>question</category>
    </item>
  </channel>
</rss>
