<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Faith Rosella Kyalo on Medium]]></title>
        <description><![CDATA[Stories by Faith Rosella Kyalo on Medium]]></description>
        <link>https://medium.com/@faithmkyalo9?source=rss-d438cebbe404------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*H8a2cV6iI5ipZ5cGh4nUPQ.jpeg</url>
            <title>Stories by Faith Rosella Kyalo on Medium</title>
            <link>https://medium.com/@faithmkyalo9?source=rss-d438cebbe404------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 06:15:13 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@faithmkyalo9/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Node.js and Express.js]]></title>
            <link>https://medium.com/@faithmkyalo9/node-js-and-express-js-fbf20a5e3efa?source=rss-d438cebbe404------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbf20a5e3efa</guid>
            <category><![CDATA[expressjs]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Faith Rosella Kyalo]]></dc:creator>
            <pubDate>Mon, 27 Oct 2025 09:40:18 GMT</pubDate>
            <atom:updated>2025-10-27T09:40:18.150Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/318/1*hKKtUj0RJbNkMP06SEN7rg.jpeg" /></figure><p>hey, so today we are going to look at node.js and express.js. at first i didn’t know its importance because we already have JavaScript but these two make JavaScript easier.</p><p>So what is Node.js?</p><p>Node.js is a free open source tool that lets you run JavaScript outside the web browser. It is a run time environment for JavaScript.<br>Node.js can build web servers, REST APIs, real-time apps, command line tools, working with files and databases, IoT and hardware control.</p><p>node app.js is used to run a node.js code</p><p>Node.js built-in modules can be imported using require()</p><p>Npm is the package manager for node.js, helps install and manage third-party packages.</p><p>so there are several things we look at to understand node.js</p><p>Modules.</p><p>these are building blocks that organize code into reusable components, enabling maintainable and scalable applications. there are several modules that we have, built-in modules, local modules, third-party modules. the built-in modules come with node.js such as fs(file system), path, os, http.</p><p>local modules are created by the developer. third-party modules are external modules published on package managers such as npm. so we have different modules that we are going to look at for example, file system modules, path modules, url modules, http modules, os modules, crypto modules among others.</p><ul><li>ES modules(ECMA Scripts). this is the official standard for packaging js code for reuse in node.js offering a more structured way to work with modules. when we are interacting with this kind of module, we first have to include something in our package.json file.</li></ul><p>when we are initializing our npm in the terminal in our vs code, a package.json file is installed. this package.json file is a file that contains important meta data about the project as well as functional meta data like dependencies and scripts. so to use the modules, we include a type in the package.json file.</p><pre>&quot;type&quot;: &quot;module&quot;,</pre><p>an example of a es module</p><p>create a file like postController.js</p><pre>const posts = [ <br>{id:1, title:&#39;post one&#39;<br>id:2, title:&#39;post two&#39;<br>id:3, title:&#39;post three&#39;}];<br>const getPosts = () =&gt; posts;</pre><p>so there are 2 ways in which we can export this. one is if we place export before the getPosts function or we can export it to the file we want to export it to.</p><pre>export const getPosts = () =&gt; posts;</pre><p>in our other file ie index.js file</p><pre>import { getPosts } from `./postController.js&#39;;<br>console.log(getPosts());</pre><p>in the postController.js file we can export below the getPosts</p><pre>const getPosts = () =&gt; posts;<br>export{getPosts};</pre><p>we can also export a default. but for this we code it in the index.js file but for this we shall have to remove the curly braces on import. this is how it is.</p><pre>import getPosts from `./postController.js&#39;;<br>console.log(getPosts());<br><br>export default getPosts;</pre><ul><li>HTTP module and creation of a server.</li></ul><p>Http module is an in-built core module that provides functionality to create HTTP servers and make http client requests. what this module does, it creates servers, making http clients requests, handling http details such as header, methods, status codes, request and response streams. lets create a server and we then create a server.js file</p><p>in the server.js file</p><pre>import http from &#39;http&#39;;<br>const server = http.createServer((req, res) =&gt; {<br>res.write(&#39;hello world&#39;);<br>res.end();<br>});<br>server.listen(8080, () =&gt; {<br>console.log(&#39;server is running on 8080&#39;);<br>});</pre><p>so after creating the server, you can run it on the terminal, node server.</p><p>NPM scripts these are entries in package.json script fields used to automate tasks like minifying css, building projects.</p><p>so before we continue lets talk about nodemon. now nodemon enables the server to restart automatically which eases us from always starting the server manually. therefore, we install nodemon and it will have its own file. so in situations where your pushing your work it github, you wont want to push node modules folder because it could be easily reproduced and to prevent this you can create a .gitignore file. in the .gitignore file we put node_modules, this will prevent node modules from reproducing.</p><p>in the package.json file we now put nodemon in the scripts</p><pre>&quot;start&quot;: &quot;nodemon server.js&quot;</pre><p>The .env</p><p>env variables are variables that are in your environment or system and can access them in different programming languages.</p><p>we use process.env property to return an object containing the user environment.</p><p>Building a simple API</p><p>an API (application programming interface) this is a communication point between frontend and backend.</p><p>you can create another server file. ie server2.js<br>and since we are only using http we can import. we can then create users</p><pre>import {createServer} from &#39;http&#39;;<br> const PORT = process.env.PORT;<br><br>const users = [<br>{id: 1, name:&#39;faith&#39;}<br>{id: 2, name:&#39;ella&#39;}<br>{id: 1, name:&#39;rose&#39;}<br>];<br><br>const server = createServer((req, res) =&gt; {<br> if(req.url === &#39;/api/users&#39; &amp;&amp; req.method === &#39;GET&#39;) {<br>res.setHeader(&#39;Content-Type&#39;, &#39;application/json&#39;);<br>res.Write(JSON.stringfy(users));<br>res.end();<br>} else if (res.url.match(/\/api\/users\/([0-9]+)/) &amp;&amp; req.method === &#39;GET&#39;) {<br>const id = req.url.split(&#39;/&#39;)[3];<br>const user = user.find((user) =&gt; user.id === parseInt(id));<br>res.setHeader(&#39;Content-Type&#39;, &#39;application/json&#39;);<br>if (user) { <br>res.Write(JSON.stringfy(user));<br>} else {<br>res.statusCode = 404;<br>res.Write(JSON.stringfy(message: &#39;user not found&#39;));<br>}<br>res.end();<br>} else {<br>res.setHeader(&#39;Content-Type&#39;, &#39;application/json&#39;);<br>res.statusCode = 404;<br>res.Write(JSON.stringfy(&#39;message: not found&#39;));<br>res.end();<br>});<br><br>server.listen(PORT, () =&gt; {<br>console.log(&#39;server is running on port ${PORT});<br>});</pre><p>to test if the API is working, you can use Postman and then we test them using the endpoint i.e localhost:8080/api/users</p><p>there are other sections that are included in node.js ie middleware, handlers and other modules. we shall look at them later.</p><p>Express.js</p><p>Express is a minimal and flexible web frameworks for Node.js.</p><p>but before we go further with express, we should know what a library and a framework is.</p><p>a library is a collection of functions that your code calls to perform specific tasks giving you control over the application’s flow.</p><p>A framework provides a complete structure for your application and the framework ‘s code calls your custom code at predefined points.</p><p>we are just going to look at different things but not so many, i.e setting status codes, POST, PUT, DELETE requests, making request from frontend among others.</p><p>setting status codes.</p><p>a status code is a three-digit number sent by a server to a client (like a web browser) to indicate the outcome of a request. examples include;</p><p>200 — success, 300- redirects, 400- client error, 500- server errors among others.</p><pre>res.statusCode = 404;<br>res.Write(JSON.stringfy(message: &#39;user not found&#39;));<br>}</pre><p>Basic routing.</p><p>routing refers to how an application responds to client requests to specific endpoints (URIs) using different HTTP methods (GET, POST, PUT, DELETE, etc.)</p><p>an endpoint is a specific addressable location or URI where a client can access a particular resource or functionality provided by the API. e.g http://api.example.com/users</p><p>we use these different http methods</p><p>app.get() — this handles GET requests</p><p>app.post() — this handles POST requests</p><p>app.put() — this handles PUT requests</p><p>app.delete() — this handles DELETE requests</p><p>app.all() — this handles all HTTP methods</p><p>this is a simple example of the how we use the different http methods</p><pre>router.get(&#39;/&#39;, controller.getStudents);<br>router.get(&#39;/:id&#39;, controller.getStudentById);<br>router.post(&#39;/&#39;, controller.addStudent);<br>router.delete(&#39;/:id&#39;, controller.removeStudent); <br>router.put(&#39;/:id&#39;, controller.updateStudent);</pre><p>making requests from frontend</p><p>so we are going to have frontend javascript<br>- open a folder an name it public and this is where we have our html files<br>- in our html files, we can create a h1, button, output then we include the script tag.<br>- in the public folder we create a js folder and a js file.</p><pre>const output = document.querySelector(&#39;#output&#39;);<br> const button = document.querySelector(&#39;#addbutton&#39;);<br>// get and show posts<br>async function showPosts(){<br>try{<br>const res = await fetch(&#39;http://localhost:8000/api/posts&#39;);<br>if (!res.ok) {<br>throw new Error(&#39;failed to fetch post&#39;);<br>}<br><br>const posts = await res.json();<br>output.innerHTML = &#39;&#39;;<br><br>posts.forEach(post) =&gt; {<br> const postEl = document.createElement(&#39;div&#39;);<br>postEl.textContent =post.title;<br>output.appendChild(postEl);<br>});<br><br>} catch (error) {<br>console.log(&#39;error fetching posts: &#39;, error);<br>}<br>}<br><br>//event listeners<br>button.addEventListner(&#39;click&#39;, showPosts);</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbf20a5e3efa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git and GitHub]]></title>
            <link>https://medium.com/@faithmkyalo9/git-and-github-876becd2c106?source=rss-d438cebbe404------2</link>
            <guid isPermaLink="false">https://medium.com/p/876becd2c106</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Faith Rosella Kyalo]]></dc:creator>
            <pubDate>Mon, 06 Oct 2025 12:37:37 GMT</pubDate>
            <atom:updated>2025-10-27T06:42:55.076Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*o9QkU4Ia5MWS2CjdJXV3_g.jpeg" /></figure><p>git is a distributed version control system</p><p>version control helps to track and manage code changes over time.</p><p>distributed means that the developer’s computer has a complete copy of the code base.</p><p>to check whether you have installed git properly the command is</p><pre>git - version</pre><p>next you need to configure git to work with your name and email</p><pre>git config - global user.name &#39;faith-25&#39;<br>git config - global user.email &#39;faithmkyalo9@gmail.com&#39;</pre><p>note- after every command, you press enter</p><p>Repositories</p><p>this is where git tracks everything in your project</p><p>to create a repository in git,</p><pre>git init</pre><p>to change the branch name from ‘master’ to ‘main’ we use;</p><pre>git config - global init.default branch main</pre><p>after changing the settings, we create a new folder and open it within your editor and then re-run git init</p><pre>git init</pre><p>the branch name changes to main</p><p>branch is a parallel version of your project</p><p>to add a file(s) to a repo</p><pre>git add .</pre><p>then after adding the file, we commit it</p><pre>git commit -m &quot;first commit&quot;</pre><p>if you would like to see the git command history,</p><pre>git log</pre><p>to restore back to a git command that you had done before in situations where the commit introduces a buggy code, we can use a new command, you copy the commit hash of the commit you created first, the hash is found on the git command history, then exit the git log by pressing the q letter on the keyboard then,</p><pre>git checkout (paste the hash you copied)</pre><p>to go back to a current state which is called the head state(refers to the pointer pointing to the latest commit that was created.</p><pre>git checkout main or<br>git checkout -f main</pre><p>GitHub is a cloud platform that allows you to store you git repositories online and collaborate with others</p><p>to push your local project to GitHub you’ll need to link it to a remote repository</p><p>there are 2 types of repositories</p><p>local repository — this is a version of a project that exists on your own machine</p><p>remote repository — this is a version of a project stored on a server like GitHub, GitLab or bit bucket</p><p>when you clone a repository from GitHub, git automatically renames the remote repository as origin by default.</p><p>to switch from master branch to main</p><pre>git branch -M main</pre><p>linking our local repo to a remote origin</p><pre>git remote origin (then paste the link that you copied from the repository)</pre><p>to push your local commits to GitHub use</p><pre>git push -u origin main</pre><p>BRANCHING</p><p>branching in git allows you to create different versions of your project like a copy of your project</p><p>to create a new branch, run</p><pre>git branch (branch-name)</pre><p>if you want to switch to the newly created branch from the main branch, you run</p><pre>git checkout (branch-name)</pre><p>if you want to get back to main branch run,</p><pre>git checkout main</pre><p>to create a branch and to switch to it immediately,</p><pre>git checkout -b (branch-name)</pre><p>note: when you create a new branch, it will be based on the branch you’re currently on</p><p>when you make the changes in a file of the new branch, you git add ., then make a commit then push it using</p><pre>git push -u origin (the name of the branch)</pre><p>[when you create a new branch in local repository but doesn’t appear in the remote repository, you need to sync them, to see those changes, you have to first publish your local branch,</p><pre>git push - set-upstream origin (the name of the branch) OR<br>git push -u origin (the name of the branch)]</pre><p>an upstream branch is a remote branch that your local branch tracks</p><p>if you want to push something from your local branch to your remote branch, you simply have to run</p><pre>git push</pre><p>git pull command downloads the latest changes that have been made in the remote repository and merges them into your local repo for that branch</p><pre>git pull</pre><p>if you want to merge changes from one branch to the main branch, for example i have 2 branches the main branch and the feature-branch and there are changes i made in this feature-branch and i want to incorporate them to the main branch, you must open up a pull request.</p><p>a pull request(PR) lets you share changes with your team for review and feedback. if approved then the changes can be merged to the main branch.</p><p>to open up a pull request, click compare and pull request, select new pull request, select the branch you want to merge from i.e feature-branch and then to the branch you want to merge to, click create pull request, then click create pull request that appears again.</p><p>after that process, reload the browser and click merge pull request, then click confirm merge.</p><p>SUMMARY OF THE WORKFLOW</p><ol><li>clone a repository</li><li>create a new branch from the main branch or another branch</li><li>make your changes</li><li>push the branch to the remote repository</li><li>open up a pull request</li><li>merge changes</li><li>pull the merged changes into your local main branch</li><li>repeat from step 2</li></ol><p>RESOLVING MERGE CONFLICT</p><p>A merge conflict is a situation where git is uncertain about which part to merge.</p><p>to solve the issue/conflict, shift to the main branch, then you run pull</p><p>GIT savior commands</p><ul><li>git checkout &lt;commit-hash&gt; this is a way to view history of the past commits.</li><li>git reset- it allows us to remove the traces of commits in history but gives us the changes we made in the discarded commits</li></ul><pre>get reset - soft &lt;commit-hash&gt;<br>get reset - hard &lt;commit-hash&gt;</pre><ul><li>git revert- it allows you to make changes to an old commit without losing the logs of other commits that come after it. in a situation where you deployed a feature and broke production and you want to undo its effects.</li><li>git stash- it lets you save your uncommitted changes both staged and un staged without committing them. run,</li></ul><pre>git stash</pre><p>if you are maybe done with what you were doing before and you want to return to your code you run</p><pre>git stash list\<br>hit stash apply (the stashlist eg stash@{0})</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=876becd2c106" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My Coding Experience in HTML and CSS]]></title>
            <link>https://medium.com/@faithmkyalo9/my-coding-experience-in-html-and-css-937bafb13f4e?source=rss-d438cebbe404------2</link>
            <guid isPermaLink="false">https://medium.com/p/937bafb13f4e</guid>
            <category><![CDATA[html]]></category>
            <category><![CDATA[ecommerce-website-design]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[personal-portfolio]]></category>
            <dc:creator><![CDATA[Faith Rosella Kyalo]]></dc:creator>
            <pubDate>Mon, 29 Sep 2025 11:46:35 GMT</pubDate>
            <atom:updated>2025-09-29T11:46:35.813Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*IYsXusaoqjzhsJd-S7wY2Q.jpeg" /></figure><p>Hello everyone, my name is Faith and this is how i have been doing so far. when i started doing coding is when i was back at campus but it was just basic HTML and CSS. When i started get mentorship during my graduate trainee program, I got to learn more of HTML and CSS. During this time, i have really learnt a lot and i can now be able to do a responsive design of a simple website and i can be able to clone a website. I was able to do a jumia clone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EeF35GW_D_DHTztbb5glsQ.png" /><figcaption>this was my very first project when i was back at campus</figcaption></figure><p>the above image was the first page that i did in HTML and CSS and it was not responsive but now i can do a responsive design.</p><p>I did an simple E-commerce site and simple personal portfolio and a Jumia clone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*ExEq8CkTtrvH_Glvr-VWrw.png" /><figcaption>this is the simple e-commerce with a responsive design</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CkuNJ8e-TDuAFwZWbql8_g.png" /><figcaption>my simple portfolio</figcaption></figure><p>Now here is an exciting one that I did, a Jumia clone in HTML and CSS only, can you believe!! this was one of the projects that made me believe in myself and i believed that i can continue learning how to code and do other things that can be attractive and enticing to look at.</p><p>Have a look</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*erqgI4faVO7BqxQjc7Hxhw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*oepzxcZ6MWU4oOv6PXTehQ.png" /><figcaption>JUMIA CLONE</figcaption></figure><p>That was so far my biggest project and i was a successful one.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=937bafb13f4e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advanced CSS]]></title>
            <link>https://medium.com/@faithmkyalo9/advanced-css-93683c3a3755?source=rss-d438cebbe404------2</link>
            <guid isPermaLink="false">https://medium.com/p/93683c3a3755</guid>
            <dc:creator><![CDATA[Faith Rosella Kyalo]]></dc:creator>
            <pubDate>Fri, 29 Aug 2025 06:32:33 GMT</pubDate>
            <atom:updated>2025-08-29T06:32:33.558Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*rcAzNYiZxhIzXPHtb2388g.jpeg" /><figcaption>advanced CSS</figcaption></figure><p>Previously we looked at basic CSS and now we dive into advanced CSS<br>we shall look at the core concepts in advanced CSS</p><p>CSS 2D transform property.<br>the functions<br>translate(), rotate(), scaleX(), scaleY(), scale(), skewX(), skewY(), skew(), matrix()</p><pre>transform: translate(50px, 100px);<br>transform: rotate(20deg);</pre><p>scale() it increases or decreases the size(width,height) of an element</p><pre>transform: scale(2, 3);<br>transform: skewX(20deg);</pre><p>matrix() combines all the 2D transform functions into one.</p><pre>transform: matrix(1, -0.3, 0, 1, 0, 0);</pre><p>CSS 3D transforms<br>3D transform functions rotateX(), rotateY(), rotateZ()</p><pre>transform: rotate(90deg);</pre><p>CSS transitions allows you to change property values smoothly over a given duration.<br>properties; transition, transition-delay, transition-duration, transition-timing-function<br>transition-timing-function property specifies the speed curve of the transition effect.<br>the values include ease, linear, ease-in, ease-out, ease-in-out, cubic-bezier(n,n,n,n)<br>transition-delay property specifies a delay(in seconds) for the transition effect.</p><pre>transition-delay: 1s;</pre><p>transition + transform</p><pre>transition: width 2s, height 2s, transform 2s;</pre><p>advanced CSS properties<br>- display<br>- position<br>display values<br>- block — starts on a new line, takes up 100% of available width. example &lt;p&gt;, &lt;h1&gt; to &lt;h6&gt;, &lt;div&gt;<br>- inline — doesn’t start on a new line, only takes up necessary width, can’t set width. example &lt;a&gt;, &lt;span&gt;, &lt;button&gt;<br>position values<br>-static — follows the normal flow of the page<br>-relative — follows the normal flow of the page but the position can be changed <br>-absolute — doesn’t follow the normal flow of the page but the position can be changed using left, right, top and bottom.<br>- fixed — doesn’t follow the normal flow of the page, can change position by using top, right, bottom, left. the position will be based on the screen(viewport)<br>- sticky — follows the normal flow of the page, until the user scrolls past a certain point. then it will become “position: fixed”</p><p>MEDIA QUERIES<br>This is a CSS feature that allows to make our websites look good on all screen sizes.<br>to use media queries;</p><pre>- @media (max-width:480px) {<br>.title{ font-size: 32px;<br>}<br>.paragraph{ font-size: 20px;<br>}<br>}</pre><p>common CSS breakpoints (max-width)<br>small smartphones -480px<br>large smartphones -640px<br>tablets — 768px<br>laptops — 1024px<br>desktops — 1280px<br>you can create more than one media query<br>media type<br>all, print, screen<br>media features<br>orientation, max-height, min-height, height, max-width, min-width, width<br>an example of changing different background colors of different screens devices</p><pre>body {<br>background-color: pink;}<br>@media screen and (max-width: 992px) {<br>body { background-color: blue;} }<br>@media screen and (max-width: 600px) {<br>body {background-color: green;} }</pre><p>PSEUDO CLASS(hover)<br>This allows you to hover over different maybe buttons and have a smooth transition for example if i point to a certain button its color becomes a little lighter.<br>e.g. <br>in html</p><pre>&lt;button&gt; continuous learning &lt;/button&gt;</pre><p>in CSS</p><pre>button:hover { opacity: 20%; color: blue;}</pre><p>you can add transition but you want it to apply to the other element you place it under the button element without hover</p><pre>button { transition: 300ms;}</pre><p>pseudo elements<br>to add pseudo elements you use double full colon (::)<br>the pseudo elements that we need to know are<br>- before<br>- after<br>for every pseudo element we use, we have to define some content. for the content you can always leave it blank or you can place in anything.<br>in CSS</p><pre>p:: before{<br> content:&quot;&quot;;<br>}</pre><p>ANIMATIONS<br>To create animations in CSS, we type <a href="http://twitter.com/keyframes">@keyframes</a><br>in CSS and you have to specify the name you want you animation to have e.g. pointdown, then you define the different stages of our animation. 0% is the start and 100% is the finish. to create the animation we have to define where the start will be and where the finish will be. for that we use a CSS property called transform, that gives us access to the translate property. for the translate property, we have the x and y axis slots to place in the values for example (20px, 30px), but if you want just to put a value in one axis you use translateX or translateY.<br>you then create an animation property of the element you want then you put the name of the animation(pointdown), the duration you want it to run for either infinitely or you put the time.<br>CSS animation properties; <a href="http://twitter.com/keyframes">@keyframes</a>, animation-name, animation-duration, animation-delay, animation-iteration-count, animation-direction, animation-timing-function, animation-fill-mode, animation<br>a shorthand property for animation property<br>animation: example 5s linear 2s infinite alternate;</p><pre>p {<br> animation: pointdown 1000m infinite alternate-reverse<br>}<br>@keyframes pointdown{<br> 0%{<br> transform: translateY(0); <br>}<br> 100%{<br> transform: translateY(16px); <br>}<br>}</pre><p>CSS tooltip — used to specify extra information about something when the user moves the mouse pointer over an element.<br>CSS responsive images <br>if you want the image to be responsive add the following properties</p><pre>img { max-width: 100%;<br> height: auto; }</pre><p>CSS centering images.<br>images can be centered horizontally in 2 ways<br>1 using margin: auto; then convert the image to a block element with display: block; then we define the width of the image and it must be smaller than the width of the page ie width: 50%<br>2 using display: flex; we put the image element inside a div container and we add the following in the &lt;div&gt; container.</p><pre>display: flex;<br>justify-content: center;</pre><p>then set the width of the image.<br>if you would like to center the image vertically, here is an example</p><pre>display: flex;<br>justify-content: center;<br>align-items: center;<br>height: 600px;<br>border: 1px solid black;</pre><p>Image filter effects<br>CSS filter is used to add visual effects like blur, saturation<br>its functions blur(), brightness(), drop-show(), grayscale(), hue-rotate(), invert(), opacity(), saturate(), sepia()</p><pre>filter: blur(2px);</pre><p>CSS mask-image property. this specifies a mask layer image. tis can be png image, svg image, a CSS gradient or an SVG &lt;mask&gt; element</p><pre>.mask { -webkit-mask-image: url(https://medium.com/logo.png);<br> mask-image: url(https://medium.com/logo.png);<br> mask-repeat: no-repeat;</pre><p>using gradients as the mask layer<br>1. linear gradient — this goes from top(black) to bottom(transparent)</p><pre>.mask { <br>-webkit-mask-image: linear-gradient (black, transparent);<br> mask-image: linear-gradient(black, gradient); <br>}</pre><p>2. radial gradient — this is shaped as a circle</p><p>CSS variable var() function<br>var() is used to insert the value of a CSS variable <br>syntax<br>var( — name, value)</p><p>CSS variables can have a global scope, you declare it inside the :root selector and for the local scope, you declare it inside the selector that is going to use it.<br>Responsive Web Design<br>we can use<br>1. viewport <br>2. grid-view<br>3. media queries<br>4. images — using the width property, set a percentage of the width and height to auto. or using max-width property by setting a percentage of the max-width to 100%</p><p>BEM(Block Element Modifier) CSS<br>this is a method of writing CSS classes to keep code organized.<br>e.g.</p><pre>&lt;div class=&quot;box&quot;&gt;<br> &lt;h2 class=&quot;box__title&quot;&gt;welcome&lt;/h2&gt;<br> &lt;p class=&quot;box__paraghaph&quot;&gt;how are you&lt;/p&gt;<br> &lt;button class=&quot;box__button box__button - active&quot;&gt;click&lt;/button&gt;<br>&lt;/div&gt;</pre><p>Flexbox is a layout method for arranging items in rows or columns<br>components — flex container, flex items<br>to start using flexbox, you need to first define a flex container. the flex container becomes flexible by setting the display property to flex.<br>1. flex-direction <br>2. flex-wrap<br>3. flex-flow<br>4. justify-content<br>5. align-items<br>6. order</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93683c3a3755" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Learning Basic CSS]]></title>
            <link>https://medium.com/@faithmkyalo9/learning-basic-css-1358b095cfbb?source=rss-d438cebbe404------2</link>
            <guid isPermaLink="false">https://medium.com/p/1358b095cfbb</guid>
            <dc:creator><![CDATA[Faith Rosella Kyalo]]></dc:creator>
            <pubDate>Tue, 26 Aug 2025 09:34:21 GMT</pubDate>
            <atom:updated>2025-08-26T09:34:21.597Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*UiWjIV4cEMSKl8CWwcv8fw.png" /><figcaption>Cascading Style Sheet</figcaption></figure><p>CSS — Cascading Style Sheet. this is a language that we use to style an HTML document.</p><p>CSS is used to beautify and give an attractive look to a web page(s).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e_BpEQiQC03J5Cq5mTDJJg.png" /><figcaption>a sample of a webpage containing CSS</figcaption></figure><p>there are 3 methods for adding CSS to HTML<br>1. Inline CSS — add styles directly in the html element by using the style attribute.</p><pre>&lt;p style=&quot;color: pink; text-align: center:&quot; &gt;this is basic CSS&lt;/p&gt;</pre><p>2. Internal CSS — using &lt;style&gt; tags within a html document. this is done in the head tag.</p><pre>&lt;style&gt;<br>body {<br>background-color: blue;<br>}<br>p {<br>color: red;<br>font-family: arial;<br>}<br>&lt;/style&gt;</pre><p>3.External CSS — linking an external CSS file to the html document. you create a CSS file and then link it to the html file using;</p><pre>&lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot;&gt;</pre><p>this is done in the head section.</p><p>CSS properties<br>1.colors- there are 3 ways to set colors;</p><pre>h1 { color: red;<br>color: rgb(0,0,255);<br>color: #0000ff;}</pre><p>2. background. the properties are;</p><p>background-color, image, repeat, position, attachment. but instead of specifying all the background properties, you can just use a shorthand property.</p><pre>body {<br>background: blue url(https://medium.com/&quot;bright.jpg&quot;) no-repeat right top;<br>}</pre><p>3. border. the properties include;</p><p>border-style, width, color, radius, sides, left, right, top, bottom. to simplify all these or to shorten the code, we just use a shorthand property.</p><pre>p {<br>border: 8px solid red;<br>}</pre><p>if you would like your borders to be rounded, you use border-radius</p><pre>p {<br>border-radius: 5px;<br>}</pre><p>4. margin. The CSS margin properties are used to create space around elements, outside of any defined borders.</p><p>the properties include;</p><p>margin-top, right, bottom, left. and they can have the following values auto, inherit, length, %. still you can use a short hand property. this margin property has 4 values; top margin, right margin, bottom margin and left margin respectively.</p><pre>margin: 20px 10px 15px 12px;</pre><p>5. padding. padding properties are used to generate space around an element’s content, inside of any defined borders.</p><p>these properties include;</p><p>padding-top, right, bottom, left. and they can have the following values auto, inherit, length, %. still you can use a short hand property. this padding property has 4 values; top padding, right padding, bottom padding and left padding respectively.</p><pre>padding: 20px 10px 15px 12px;</pre><p>the properties of CSS are many to mention but a few. others include; font, text among others.</p><p>Specificity — the prioritization of styles.<br>Selectors — selects the html element you want to style.<br>- simple selectors<br>- combinator selectors<br>- pseudo-class selectors<br>- pseudo-elements selectors<br>Attribute selectors<br>id — highest priority<br>classes — 2 highest priority<br>generics — lowest priority</p><p>In situations where we need to maybe give one color to a certain paragraph and another paragraph a different color, we create class names.<br>class names provides a way to single out certain elements and we only want to add styles to them. for example in html</p><pre>&lt;p class=&quot;paragraph-1&quot;&gt; we are learning basic CSS &lt;/p&gt;</pre><p>in CSS</p><pre>.paragraph-1 { color: red;}</pre><p>for classes we use a dot (.) at the beginning<br>for id we use #</p><pre>#id-name{color: black}</pre><p>Combinators. this is something that explains the relationship between the selectors. these include<br>-descendant combinators(space)<br>-child combinators(&gt;)<br>-next sibling combinators(+)<br>-subsequent-sibling combinators(~)</p><p>Pseudo classes. this is used to define a special state of an element.<br>syntax of pseudo-classes</p><pre>selector:pseudo-class {<br> property: value;<br>}</pre><p>Pseudo elements are used to style specific parts of an element.<br>syntax</p><pre>selector::pseudo-element {<br> property: value;<br>}</pre><ol><li>first-line can only be applied to block-level elements.<br>properties of first-line<br>-font, color, background, word-spacing, letter-spacing, text-decoration, vertical-align, text-transformation, line-height, clear.</li></ol><p>::first-line is used to add a special style to the first line of a text.</p><pre>p::first-line {<br>  color: #ff0000;<br>  font-variant: small-caps;<br>}</pre><p>2. first-letter, to add a specific style to the first letter of a text.</p><pre>p::first-letter {<br>color: blue;<br>font-size: xx-large;<br>}</pre><p>the ::before pseudo element<br>this is used to insert some content before the content of an element.</p><pre>h1::before {<br> content: url(https://medium.com/smiley.gif);<br>}</pre><p>the ::after pseudo element<br>this is used to insert some content after the content of an element.</p><pre>h1::after{<br> content: url(https://medium.com/smiley.gif);<br>}</pre><p>the ::marker pseudo element<br>this is selects the markers of list items.</p><pre>::marker {<br> color: red;<br>}</pre><p>the ::selection pseudo element<br>this matches the portion of element that is selected by a user. this is applied to color, background, cursor, outline</p><pre>::selection{<br> color: blue;<br> background: pink;<br>}</pre><p>CSS opacity/transparency — this specifies the transparency of an element. the value is from 0.0 to 1.0<br>transparent hover effect</p><pre>img {<br> opacity: 0.5;<br>}<br>img::hover{<br> opacity: 1.0;<br>}<br>transparent box<br>div {<br> opacity 0.5;<br>}</pre><p>text in a transparent box</p><pre>&lt;html&gt;<br>&lt;head&gt;<br>&lt;style&gt;<br>div.background {<br>  background: url(https://medium.com/klematis.jpg) repeat;<br>  border: 2px solid black;<br>}<br><br>div.transbox {<br>  margin: 30px;<br>  background-color: #ffffff;<br>  border: 1px solid black;<br>  opacity: 0.6;<br>}<br><br>div.transbox p {<br>  margin: 5%;<br>  font-weight: bold;<br>  color: #000000;<br>}<br>&lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br><br>&lt;div class=&quot;background&quot;&gt;<br>  &lt;div class=&quot;transbox&quot;&gt;<br>    &lt;p&gt;This is some text that is placed in the transparent box.&lt;/p&gt;<br>  &lt;/div&gt;<br>&lt;/div&gt;<br><br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p><strong>the box model</strong><br>this divides the elements on our page into four different layers<br>content- the content of the box, where text and images appear -width: 200px;<br>padding- clears an area around the content — padding: 16px;<br>border- a border that goes around the padding and content — border: 8px solid red;<br>margin- clears an area outside the border — margin: 10px;<br>box-sizing — box-sizing: border-box;<br>box-sizing has 2 properties, the content-box and border-box<br>content-box is a default and it includes the width and height properties while border and padding are not.<br>border-box has the width and height properties and includes content, padding and border.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_H_UEPkFep7Q6C81smbNkQ.png" /></figure><p>CSS math functions<br>these functions allow mathematical expressions to be used as property values. e.g. calc(), max() and min()<br>calc(.) performs a calculation.<br>max(.) uses the largest value, from a comma separated list of values as the value property.<br>min(.) uses the smallest value, from a comma separated list of values as the value property.</p><p>CSS PERFORMANCE AND OPTIMIZATION<br>this helps your website to run smoothly and load faster even on slower devices.<br>1. use simple selectors<br>2. avoid universal selector for styling(*)<br>3. avoid inline styles<br>4. combine and minify CSS<br>5. load CSS efficiently<br>6. use shorthand properties<br>7. cache you CSS</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1358b095cfbb" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>