<?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 Teresa Marbán Castro on Medium]]></title>
        <description><![CDATA[Stories by Teresa Marbán Castro on Medium]]></description>
        <link>https://medium.com/@teresamarbancastro?source=rss-967eb2082085------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*h8Ttt8BxSKQRKx9LdHzOoA.jpeg</url>
            <title>Stories by Teresa Marbán Castro on Medium</title>
            <link>https://medium.com/@teresamarbancastro?source=rss-967eb2082085------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 03:31:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@teresamarbancastro/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[Etiquetas HTML5 y Web Components]]></title>
            <link>https://medium.com/@teresamarbancastro/web-components-y-etiquetas-html5-67fef61ff7a6?source=rss-967eb2082085------2</link>
            <guid isPermaLink="false">https://medium.com/p/67fef61ff7a6</guid>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[html]]></category>
            <category><![CDATA[html-tags]]></category>
            <dc:creator><![CDATA[Teresa Marbán Castro]]></dc:creator>
            <pubDate>Thu, 19 Jul 2018 10:57:01 GMT</pubDate>
            <atom:updated>2018-07-19T11:00:29.243Z</atom:updated>
            <content:encoded><![CDATA[<p>El uso de las <strong>etiquetas</strong> <strong>HTML</strong> a discreción está bastante extendido. De hecho, muchas veces las utilizamos sin plantearnos qué funciones y usos específicos tienen más allá de describir semánticamente el contenido de nuestro código.</p><p>Afortunadamente, hay alguien que sí hace esta tarea por el resto. El organismo <strong>W3C</strong> es el encargado de regular los estándares de HTML, CSS y JS. Entre estos estándares se encuentran las etiquetas <strong>predefinidas</strong> de HTML, y los <strong>web components.</strong></p><h4>Etiquetas HTML</h4><p>Las etiquetas predefinidas de HTML contienen <strong>funcionalidades y atributos</strong> específicos que nos permiten colocar distintos elementos en el DOM de una manera fácil y además le brindan al navegador la información necesaria para que los pinte correctamente.</p><p>Por ejemplo, la etiqueta &lt;select&gt;&lt;/select&gt;define una lista desplegable de elementos en la que podemos especificar diferentes opciones.</p><p>Para poder modificar estas etiquetas, podemos añadir los <strong>data-attributes</strong> de HTML5, que sirven para almacenar información que no es estándar o no está incluida en una determinada etiqueta.</p><pre>&lt;input radio=&quot;&quot;&gt;&lt;/input&gt;</pre><pre>&lt;div data-key=&quot;65&quot; class=&quot;audio&quot;&gt;&lt;/div&gt;</pre><p>En el ejemplo anterior vemos cómo la etiqueta <em>input</em> tiene el atributo <em>radio</em> incorporado y <strong>definido</strong> por la W3C, mientras que en el <em>div</em> <strong>añadimos nosotras </strong>el atributo <em>data-key </em>para obtener información de la tecla que pulsa el usuario.</p><p>Aunque esta forma de modificar atributos de las etiquetas HTML nos presenta innumerables posibilidades, si queremos crear una etiqueta propia y compartirla con la comunidad podemos usar los <strong>web component.</strong></p><h4>Web Components</h4><p>Son entidades que permiten <strong>construir nuevas etiquetas </strong>siguiendo unas especificaciones. Siguen unos estándares universales y esto hace que sean independientes y <strong>reutilizables</strong> en distintos proyectos.</p><p>Entre las ventajas que nos ofrecen se encuentran la posibilidad de aunar funcionalidades propias en una única etiqueta, extender de otros elementos del DOM y reflejar propiedades en atributos.</p><p>Para <strong>implementar</strong> web components de otras personas en nuestro código, sólo tenemos que instalarnos los custom elements con las instrucciones del README.md , importarlos e insertar la etiqueta que hayan determinado. Por ejemplo:</p><pre>&lt;link rel=&quot;import&quot; href=&quot;../emoji-rain/emoji-rain.html&quot;&gt; <br>&lt;emoji-rain active&gt;&lt;/emoji-rain&gt;</pre><p>Este web component hará que empiece una lluvia de emojis en tu página ;) . En <a href="https://www.webcomponents.org/introduction"><em>webcomponents.or</em></a><em>g</em> explican cómo implementar los componentes y cómo <strong>crear</strong> los tuyos propios.</p><p>Así que ¡manos a la obra! Es hora de crear.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67fef61ff7a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is this?]]></title>
            <link>https://medium.com/@teresamarbancastro/what-is-this-44b786b4853b?source=rss-967eb2082085------2</link>
            <guid isPermaLink="false">https://medium.com/p/44b786b4853b</guid>
            <category><![CDATA[js]]></category>
            <category><![CDATA[this]]></category>
            <dc:creator><![CDATA[Teresa Marbán Castro]]></dc:creator>
            <pubDate>Thu, 24 May 2018 09:35:57 GMT</pubDate>
            <atom:updated>2018-05-24T15:03:58.029Z</atom:updated>
            <content:encoded><![CDATA[<p>This es una palabra reservada que se utilizar para referirse al contexto más cercano. No obstante hay que usarla con cuidado, ya que a veces conlleva comportamientos inesperados.</p><p>En el siguiente ejemplo se crea una función Application que tiene una serie de variables y funciones dentro.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*x620OPJ9It9fPVGx." /></figure><p>Cuando se ejecuta la función start es normal esperar que el resultado sea 1 (this.counter= 0 + 1 = 1). No obstante no ocurre así. La razón es que al pasar como <strong>argumento</strong> this.handleEvent a addEventListener, el navegador obtiene el valor global de counter y como no tiene ningún valor, da error. Al enviar una función de un objeto a otro objeto, pierde el contexto que tenía, y por tanto el <strong>this </strong>que apunta al contexto.</p><p>Si hubiese una variable global llamada counter, tomaría el valor de ésta e ignoraría completamente this.counter.</p><p>Si queremos que esta función nos incremente en el valor del contador de la variable local de Application se puede hacer de la siguiente manera:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/0*TOFpU_Z1tP4zMca9." /></figure><p>Así evitamos el uso de <strong>this</strong> y controlamos el ámbito de las variables que toman nuestras funciones desde otros objetos.</p><p>Otro aspecto a tener en cuenta es que el uso de <strong>this</strong> está supeditado al uso de new x (), que es quien prepara para que this funcione.</p><p>Una manera para mantener el contexto del <strong>this</strong> es asignárselo a una variable:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/0*gzQ4ZoNUTbZXf-vN." /></figure><p>De esta manera al guardar el valor del <strong>this</strong> en una variable, nos aseguramos de que cuando se llame desde otro objeto se refiera al <strong>this </strong>del objeto que queremos.</p><p>En React, por ejemplo se usa <strong>this</strong>, pero se controla con la función <strong>bind</strong>. Una mejora importante fue que con las arrow functions de ECMAScript6 no hace falta, ya que no se pierde el contexto.</p><p>En <strong>resumen</strong>, si podemos evitar usar <strong>this</strong> lo haremos, para tener control sobre el ámbito de las variables.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=44b786b4853b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[¿Por qué queremos variables locales?]]></title>
            <link>https://medium.com/@teresamarbancastro/por-qu%C3%A9-queremos-variables-locales-a287dce6795f?source=rss-967eb2082085------2</link>
            <guid isPermaLink="false">https://medium.com/p/a287dce6795f</guid>
            <category><![CDATA[js]]></category>
            <category><![CDATA[scopes]]></category>
            <category><![CDATA[variables]]></category>
            <dc:creator><![CDATA[Teresa Marbán Castro]]></dc:creator>
            <pubDate>Thu, 24 May 2018 07:46:55 GMT</pubDate>
            <atom:updated>2018-05-24T07:46:55.235Z</atom:updated>
            <content:encoded><![CDATA[<p>El uso de variables locales frente a globales es considerado una buena práctica. ¿Pero por qué es así?</p><p>Más allá del problema que pueda ocasionar la <strong>colisión</strong> de variables con el mismo <strong>nombre</strong> que se usen en ámbitos distintos o incluso en scripts diferentes, también es una cuestión de <strong>memoria</strong>. No precisamente de que te pueda costar recordar cómo se llamaba una variable, sino del esfuerzo de tu máquina para recordar las variables globales.</p><p>Cuando una variable tiene ámbito <strong>local</strong> sólo tiene que ser recordada durante la ejecución del <strong>bloque</strong> de código en el que está inmersa. En cambio, las variables globales usan más memoria, ya que el navegador tiene que recordarlas en todo momento mientras la página esté cargada. Cuantas más variables tu navegador necesite recordar, más memoria necesitará tu script para correr y esto puede afectar a la velocidad de carga de la página y la interacción.</p><p>Por tanto, se procura usar variables locales siempre que sea posible para que el código sea más limpio y más eficiente. Además ayudarás a tu navegador a olvidar aquellas variables que sólo necesitaba durante un período determinado. Piensa lo cargante que podría llegar a ser no poder olvidar a aquella persona que tanto daño te hizo o que ya no te aporta nada … <br> It is time to <strong>let go</strong>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a287dce6795f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scripts y diagramas]]></title>
            <link>https://medium.com/@teresamarbancastro/scripts-y-diagramas-9e930668e4ea?source=rss-967eb2082085------2</link>
            <guid isPermaLink="false">https://medium.com/p/9e930668e4ea</guid>
            <category><![CDATA[script]]></category>
            <category><![CDATA[js]]></category>
            <category><![CDATA[diagrams]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Teresa Marbán Castro]]></dc:creator>
            <pubDate>Thu, 24 May 2018 07:41:10 GMT</pubDate>
            <atom:updated>2018-05-24T07:41:10.250Z</atom:updated>
            <content:encoded><![CDATA[<p>La mayoría hemos oído hablar del lenguaje JAVA y de cómo nació JAVASCRIPT, sin embargo no sabemos qué significa puramente <strong><em>script</em></strong>.</p><p>En inglés, el término script corresponde a guión. Y eso es precisamente lo que nuestra máquina necesita, un guión, una serie de instrucciones que le digan lo que tiene que hacer.</p><p>Cada vez que nuestros scripts corren, nuestra máquina sigue<strong> todas <em>o sólamente</em></strong><em> </em>una serie de instrucciones. Por ello, es recomendable escribir <strong>diagramas de flujo</strong> para obtener de manera visual una imagen clara de cómo “piensa” programáticamente la máquina.</p><p>Para ejemplificar la creación ordenada de secuencias que debe seguir la máquina, usaré una pequeña aplicación que calcula el precio de la personalización de un cartel en función de las letras (5€ por letra). Primero se definen los pasos y luego se crea el diagrama.</p><ol><li>Los scripts se ejecutan cuando se clica el botón.</li><li>Se recoge un nombre en el campo.</li><li>Se comprueba que se ha introducido un valor.</li><li>Si el usuario no ha introducido un valor, se le pide.</li><li>Cuando haya un nombre, se calcula el coste del cartel.</li><li>Se muestra en pantalla el resultado.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/0*-dYa1bMo1knYBBNp." /></figure><p>A nivel de interfaz gráfica (sin tocar el CSS) se visualizaría de la siguiente manera:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/0*ZI9JzbkPoEHXp1nF." /><figcaption>Sin introducir un valor en el campo y clicar, salta mensaje de alerta</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/0*4lQP2lHWN-7p2A6Z." /><figcaption>Cuando se introduce un valor, se muestra el precio</figcaption></figure><p>Nuestro <strong>HTML</strong> quedaría así:</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*b31hiO4ynbDLRrXWEFF4aQ.png" /><figcaption>HTML</figcaption></figure><p>Y en nuestro archivo <strong>JS</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/829/0*VeevHCPIObba10d4." /><figcaption>JS</figcaption></figure><p>Esta es una manera sencilla y muy básica de hacerlo, pero para empezar ¡no está mal!</p><p>Así que a escribir <strong>guiones</strong>, como si de una peli se tratara :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9e930668e4ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to manage branches in Git]]></title>
            <link>https://medium.com/@teresamarbancastro/how-to-manage-branches-in-git-a06c8e71da?source=rss-967eb2082085------2</link>
            <guid isPermaLink="false">https://medium.com/p/a06c8e71da</guid>
            <category><![CDATA[git-branch]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[branch]]></category>
            <category><![CDATA[merge]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Teresa Marbán Castro]]></dc:creator>
            <pubDate>Tue, 30 Jan 2018 12:38:14 GMT</pubDate>
            <atom:updated>2018-01-30T12:38:14.878Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>How To Manage Branches In Git</strong></p><p>If you think of a yummy Sunday meal every time you hear “/branch/”, please keep reading.</p><p><strong>Git and branches</strong></p><p>Git is a powerful distributed tool that helps with version control. It allows you to manage branches in a simple and efficient way. Branches represent independent lines of development and are useful to solve issues with the code from a project or to create new functionalities.</p><p>The master is the default branch when you create a repository. Creating new branches during development and merging them to the master branch is the way to approach projects if you want to be sure data in the original branch is safe.</p><p>So, let’s start branching in Git.</p><p><strong>Creating a branch</strong></p><p>The procedure to create a new branch is very simple. We just need to use the branch command, followed by the name of the branch we want to create. With this command we will not move to the new branch:</p><p>git branch name-of-branch</p><p>if you want to create a branch, select it and switch to it, you need to use the following command:</p><p>git checkout -b name-of-branch</p><p><strong>Switch between branches</strong></p><p>Switching back and forth between branches is really easy. To switch to an existing branch, we just need to type the checkout command on the shell. For example, if we are on the Master branch and we want to move to the Development branch:</p><p>git <strong>checkout</strong> Development</p><p>And if we want to go back to Master:</p><p>git <strong>checkout</strong> Master</p><p><strong>Renaming a branch</strong></p><p>If you are using a branch but no longer want the name you chose, you can rename it.</p><p>These are the three simple steps to follow:</p><ol><li>git branch -m <em>oldbranch</em> <strong>newbranch<br></strong>This is the step to <strong>rename</strong> the branch locally.</li></ol><p>2. git push origin :<em>oldbranch<br> </em>To <strong>delete</strong> the old branch</p><p>3. git push — set-upstream origin <strong>newbranch</strong><br>to <strong>update</strong> the changes remotelly.</p><p><strong>Deleting a branch</strong></p><p>If you are not happy with renaming the branch, you can also delete it. But please, mind that all information stored there will be lost.</p><p>It your branch is only stored locally, you can delete it by:</p><p>git branch <strong>-d </strong>nameofbranch</p><p>If you already “pushed” it</p><p>git branch <strong>-dr </strong>nameofbranch</p><p><strong>Merging a branch</strong></p><p>Another very useful action is “merging”. Merging consists of combining two branches so that information is combined and saved together.</p><p>If you had a branch named “secondary”, in order to keep the changes you have made in that branch into “master”, you will have to:</p><p>git <strong>checkout</strong> master</p><p>git <strong>merge</strong> secondary</p><p>It works in that direction, i .e. if you want all changes into your secondary branch, you will have to git checkout secondary and merge master into it.</p><p>This may seem messy, but think of it as a way of bringing the information you changed into the current branch where you want to save the changes.</p><p>Easier?</p><p>No, let’s see a visual aid:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/0*OnL3DaMx60MeHl8s." /></figure><p>The dark blue branch is called “secondary” and the light blue branch is “master”.</p><p>If I am working on secondary but I want data from master I will have to stay in secondary (if you are not, use git checkout secondary) and I will <strong>merge</strong> master (git merge master). This way I bring data from master and keep working on my secondary branch.</p><p>Don’t panic, you can check the number of branches you have created and their names in github, as shown in the image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*nKFAQ6DEZLgtG_WF33-m7g.png" /></figure><p>Got it??</p><p>Now, let’s go for that yummy Sunday brunch</p><p>:)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a06c8e71da" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SASS for beginners]]></title>
            <link>https://medium.com/@teresamarbancastro/sass-for-beginners-7b3a7748b015?source=rss-967eb2082085------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b3a7748b015</guid>
            <category><![CDATA[variables]]></category>
            <category><![CDATA[sass]]></category>
            <category><![CDATA[mixin]]></category>
            <category><![CDATA[scss]]></category>
            <category><![CDATA[beginner]]></category>
            <dc:creator><![CDATA[Teresa Marbán Castro]]></dc:creator>
            <pubDate>Tue, 30 Jan 2018 11:57:14 GMT</pubDate>
            <atom:updated>2018-02-23T08:38:42.708Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Beginners Guide to SASS</strong></p><p>SASS has become a useful tool for web developers because it is a way to simplify our CSS workflow and make it friendlier. For example, thanks to SASS we can change or replace particular properties of elements in an easy and fast way.</p><p>SASS stands for <strong><em>Syntactically Awesome StyleSheets</em></strong> and it is a preprocessor, a scripting language that extends CSS and allows writing code in a language and compiles it into a CSS file. Other examples of preprocessors are LESS and Stylus.</p><p><strong>Syntax</strong></p><p>There are two options for syntax in SASS:</p><p>1.- SCSS (Sass &amp; CSS): This syntax is built on the existing syntax of CSS, and just like CSS, it uses brackets and semicolons, but in this case, SCSS doesn’t care about indentation levels or blank spaces.</p><p><strong>Pros of SCSS syntax</strong></p><p>One of the advantages of SCSS is that it allows us to nest selectors within selectors. This is especially useful because when you have to change the “name” of an element you will just have to do it in one place (the outer selector).</p><p>2.- Sass Indented Syntax (SASS): Unlike CSS, instead of using brackets to delimit blocks of styles and semicolons to separate statements, the SASS syntax uses indentation and line breaks. This allows the coder to use less amount of text.</p><p><strong>Pros of SASS syntax</strong></p><p>The indented syntax does not use semicolons and brackets <br>and therefore the SASS syntax is more concise and easier to read, besides it doesn’t complain about missing semicolons.</p><p>/* SCSS */<br>$grey: #c1c1c1;<br>$margin: 16px;<br>.content {<br>border-color: $grey;<br>margin-top: $margin;<br>}</p><p>/* SASS */<br>$grey: #c1c1c1<br>$margin: 16px<br>.content<br>border-color: $grey;<br>margin-top: $margin</p><p>/* CSS */<br>.content{<br>border-color: #c1c1c1;<br>margin-top: 16px;<br>}</p><p><strong>Variables</strong></p><p>Variables are used to store information that will be used through the stylesheets. They are very useful in order to save time rewriting code and when it is needed to change a property in different places, for example a background colour, sizes, fonts…</p><p><em>How do variables work?</em></p><p>In this example font style and colour are stored in two variables. In case it was needed to change these features, it would be done simply by changing it in the variable. Note that every other place in which the variable has been introduced will change as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*0rCVpciHzXC2TnJqVGFVwQ.png" /></figure><p><strong>Mixins</strong></p><p>Mixins are useful to store different variables or parts of code that repeat themselves.</p><p>In this example we can store two different variables together in a mixin. Then we can incorporate these styles together by simply adding ‘@include ‘ and the name of the mixin followed by ().</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*lUvu1y6NoxXAiIQTKeO_-w.png" /></figure><p><strong>Imports</strong></p><p>In our scss, we can create different partials so that our code looks tidier.</p><p>Partials are files which start by ‘_’ followed by the name.scss.</p><p>In order for SCSS to work, we import all of these partials in our main.scss file. As shown in the image, the order in which we include the files is very important.</p><p>For example, core files have to come first so that the rest works perfectly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*QQNFmWhReiG2N4pxoSaxkQ.png" /></figure><p>Thanks for reading and we hope it helped a little! :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b3a7748b015" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BEM or How To Keep Your CSS Organized]]></title>
            <link>https://medium.com/@teresamarbancastro/bem-or-how-to-keep-your-css-organized-32cffa059731?source=rss-967eb2082085------2</link>
            <guid isPermaLink="false">https://medium.com/p/32cffa059731</guid>
            <category><![CDATA[bem]]></category>
            <category><![CDATA[css]]></category>
            <dc:creator><![CDATA[Teresa Marbán Castro]]></dc:creator>
            <pubDate>Tue, 09 Jan 2018 11:44:46 GMT</pubDate>
            <atom:updated>2018-01-09T11:44:46.979Z</atom:updated>
            <content:encoded><![CDATA[<p>Keeping your CSS or style sheets organized is not always an easy task especially when working with other developers in a team effort. Fortunately, in the last years new methodologies have been created to help standardize the structure of CSS and keep it simpler. BEM is one of them.</p><p>BEM is an acronym for Block, Element and Modifier. This methodology is a way of organising semantically, class names and keeping styles maintainable. It was developed by the Russian multinational technology company Yandex.</p><p>The main goals of this methodology include:</p><ul><li>Improving the development time of a project.</li><li>Improving the maintainability of the stylesheets</li><li>and finally, helping teams of developers that work in the same project by following a strict coding standard.</li></ul><p><strong>How BEM works:</strong></p><p><strong>Block</strong>: Represents a section of content. This is a container of a reusable group of items or elements.</p><p>Tip: avoid specific names, like ‘agency-menu’, and instead use more generic names like ‘menu’. This way, you can reuse this class in other context.</p><p><strong>Element</strong>: an item or a part inside the Block content. In other words, it is a child element inside its block.</p><p>Tip: You can only define one level of element nesting, for example: article_title or article_text.</p><p><strong>Modifier</strong>: It helps us provide variants to a block or to an element.</p><p>Tip: The modifier class always is accompanied with the block or element class like article — feature</p><p>Let’s see an example</p><p><strong>HTML:</strong></p><p>&lt;div class=”article”&gt;<br>&lt;h1=”article_title&gt; &lt;/h1&gt;<br>&lt;p=”article_text&gt; &lt;/p&gt;<br>&lt;/div&gt;</p><p><strong>CSS:</strong></p><p>.article {} // block;</p><p>.article_text {} // element;</p><p>.article_title {} // element;</p><p>.article_text — large{} // modifier;</p><p><strong>Why you should consider using BEM?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/0*uTLQf4UAT43zhDif." /></figure><p>Among the main benefits of using BEM, there are three striking ones:</p><p>Its <strong>modularity; </strong>the fact that block styles do not depend on other elements of a page provides a solution to problems that arise from cascading.</p><p>Furthermore, blocks are able to be transferred to other projects, which helps developers <strong>recycle</strong> code and save time on writing code again and again. Moreover, developers can also build a library of blocks so that the access to them is easier.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/641/0*xMR6CqVVAXM66qt9." /></figure><p>Lastly, the straight-forward <strong>structure</strong> of BEM methodology is easy to follow and to understand. Thus, team work is manageable. BEM trees, the consistent marking of a document with BEM entities, provides innumerable advantages to the so-called <em>blind</em> users.</p><p>Examples:</p><p>/* Block component */<br>.btn {}</p><p>/* Element that depends upon the block */ <br>.btn__price {}</p><p>/* Modifier that changes the style of the block */<br>.btn — orange {} <br>.btn — big {}</p><p><strong>Reference for images:<br></strong><a href="https://www.toptal.com/css/introduction-to-bem-methodology">https://www.toptal.com/css/introduction-to-bem-methodology</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32cffa059731" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to implement images in our website]]></title>
            <link>https://medium.com/@teresamarbancastro/how-to-implement-images-in-our-website-d62d7df9f1db?source=rss-967eb2082085------2</link>
            <guid isPermaLink="false">https://medium.com/p/d62d7df9f1db</guid>
            <category><![CDATA[img]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[hml]]></category>
            <dc:creator><![CDATA[Teresa Marbán Castro]]></dc:creator>
            <pubDate>Mon, 11 Dec 2017 12:34:35 GMT</pubDate>
            <atom:updated>2018-02-08T07:45:14.132Z</atom:updated>
            <content:encoded><![CDATA[<p>Just like the saying <em>“An image is worth a thousand words”, </em>we can make our webpages more attractive by adding images instead of simply text.</p><p>Here, we will show you the basics for including images in your webpage with HTML and CSS:</p><p><strong>1. Basic use of “img” tag</strong></p><p>The basic tag to include an image in your HTML code is &lt;img&gt;, and unlike other tags, this one doesn’t need an end tag. It only requires two specific attributes: <strong><em>src</em></strong> and <strong><em>alt</em></strong>.</p><p><strong>&lt;img scr=“ ” alt =“ ”&gt;</strong></p><p>The <strong><em>src</em></strong> attribute indicates where the image is hosted. It can be a file located inside our project or an URL.</p><p><strong>&lt;img scr=“http://placehold.it” alt =“ ”&gt;<br> &lt;img scr=“img/house.jpg =“ ”&gt;</strong></p><p>The <strong><em>alt</em></strong> attribute allows us to write a description about the content or the purpose of the image. This text will be visible in case the image doesn’t load correctly.</p><p><strong>&lt;img scr=“http://placehold.it” alt =“image of a house”&gt;</strong></p><p>We can also set the width and height of the image using these attributes inside the <em>img</em> tag. For example:</p><p><strong>&lt;img scr=“http://placehold.it” alt =“image of a house” width=“500” height=“400”&gt;</strong></p><p>To make an image responsive in our HTML, we have to adapt its size to its container by adding the following attribute inside the <em>img</em> tag:</p><p><strong>style=“max-width:100%; width:auto; height:auto ”</strong></p><p><strong>2. Icons</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*ERkGx9uwx47NldWR." /></figure><p>Icons are very useful images that we can use for a number of purposes. We may want to include an icon as a symbol for items in a list, perhaps we want to use an icon as a banner that takes us to another page or we want it to takes us back to the beginning of our page when we click on it, we may want to include it in a menu…and the list goes on and on!</p><p>So once we have agreed on the purpose of our icons, there are several ways to include them in our webpage. The simplest one is to add an image with a link to where you want it to take you. In order to do so, we need to follow these simple steps:</p><p>1) The first thing we need to do is to make sure we have correctly included the image we are going to use in the correct folder.</p><p>2) We then use <strong>&lt;a href&gt; &lt;/a&gt; </strong>to include the webpage we want people to be sent to when they click on the image, and we include the image within this tag.</p><p><strong>&lt;div class=”button”&gt;</strong></p><p><strong>&lt;a href=”</strong><a href="http://www.adalab.es/"><strong>http://www.adalab.es</strong></a><strong>&quot;&gt;</strong></p><p><strong>&lt;img src=”images/button.jpg” alt=”button”&gt; &lt;/a&gt;</strong></p><p><strong>&lt;/div&gt;</strong></p><p>If you want your icon to take you to another place within your page, for example the beginning of the page, you simply have to include this information instead of the external url:</p><p><strong>&lt;div class=”button”&gt;</strong></p><p><strong>&lt;a id=”maincontainer” href=”#maincontainer”&gt;</strong></p><p><strong>&lt;img src=”images/button.jpg” alt=”button”&gt; &lt;/a&gt;</strong></p><p><strong>&lt;/div&gt;</strong></p><p>In this case, we assigned an id called “maincontainer” to our body, so when we click on our icon, it takes us to the beginning of our html document. We can do it to take us anywhere within our page where we have assigned a particular id.</p><p>3) Using <strong><em>alt=” “</em> </strong>you can write whatever information you consider is important to see in case the image fails to be shown on screen.</p><p>There are other ways to incorporate icons in our html, such as referencing directly an icon from a page, but the aforementioned is the easiest way.</p><p>Regarding where to obtain icons from, there are different webpages providing icons for free, such as<a href="http://www.flaticon.com/"> www.flaticon.com</a> but you can also create your own or include any image that you like.</p><p><strong>3. Image as background property</strong></p><p>Images can be used as background of your webpage. This can be useful when you want to make sure that every kind of image is going to fit perfectly in your structure and CSS rules, without any problem of deformity and/or when you want your image taking all the space. In this article, we are going to focus on the most useful attributes to achieve this.</p><p><strong>How can we use this property?</strong></p><p>First of all, we begin setting this property using <strong><em>background-image</em></strong> attribute.</p><p>For example, if you want to set a background-image for the &lt;main&gt; element:</p><p><strong>main {</strong></p><p><strong>background-image: url (yourperfectimage.jpg);</strong></p><p><strong>}</strong></p><p>The <strong>url() </strong>value allows you to provide a file path for your image.</p><p>If a background image fails to load, the browser will look for a background color as a fallback. You can specify your <strong>fallback color</strong> like this:</p><p><strong>main {</strong></p><p><strong>background-image: url (yourperfectimage.jpg) green;</strong></p><p><strong>}</strong></p><p><strong>Repeat.</strong> It indicates in which direction the background image should be repeated or if it should not be repeated. In our case, if you want a single image to occupy the entire screen, you can use this:</p><p><strong>main {</strong></p><p><strong>background-repeat: no-repeat;</strong></p><p><strong>}</strong></p><p><strong>Position.</strong> Tell the browser where to place the background image. You can use to specify it: percentage, length, inherit, top, bottom, left, right, center. In our case, we want the image in the centre:</p><p><strong>main {</strong></p><p><strong>background-position: center center;</strong></p><p><strong>}</strong></p><p><strong>Size</strong>. The background-size property specifies the size of the background images. There are different possibilities; auto, length<em>, </em>cover, contain, initial, inherit. In our case we would use “cover”, because we want the background area completely covered by the image:</p><p><strong>main {</strong></p><p><strong>background-size: cover;</strong></p><p><strong>}</strong></p><p>In the following images we can see the result in two different screen sizes, applying the styles of our example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dkFNVtt6-nb-rgoq." /></figure><p>Above: occupying the full width when the screen is larger. On the right. occupying the entire height of the screen, regardless of width.</p><p><strong>4. CSS tips for images</strong></p><p>Images are very important for a web site. They allow us to break with linearity and prevent our visitors from getting bored of our content. Here are some CSS trick that can help us to improve the styling and presentation of images.</p><p><strong>Styling images</strong></p><p>Go beyond your plain image and play with some properties to add style and depth.</p><p><strong>1) Box-shadow:</strong></p><p>This property adds a shadow effect to an image specifying the vertical shadow and the horizontal shadow, as shown in the following example:</p><p><strong>img {<br> box-shadow: 10px 10px 5px #BBBBB;<br> }</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*O1Di22wry6F-ElQI." /></figure><p>The third number controls the blur of the shadow, the higher the number the fuzzier the shadow will be. The last value shown in the example allows you to set the colour for the shadow effect.</p><p>Tip: The shadow effect should be used subtly or otherwise we will make it more difficult for visitors to look at the web site.</p><p><strong>2) Border</strong></p><p>To get more out of an image you can consider adding a border. In this case, CSS offers us some options to play with.<br>To set the border property for an image, we follow this rule:</p><p><strong>img {<br> border: 5px double grey;<br> }</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/0*4yIdx8JKl0ruWhqv." /></figure><p>The first number sets the thickness of the border, the second specifies the type of border we want (solid, double, dotted, dashed, ridge or groove) and the last value represents the colour of the border.</p><p><strong>3) Border-radius</strong></p><p>If you’re not a big fan of the box-looking-style, the border-radius property is your best choice. It allows you to get round corners or even full-circular images.</p><p>To get slightly rounded corners you can change the pixels in the border-radius property:</p><p><strong>img {<br> border-radius: 10px; <br> }</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1003/0*5a7rUxVjl727Hw3e." /></figure><p>With this rule you can turn a square image into a full-circular image</p><p><strong>.img-circle {<br> border-radius: 50%;<br> }</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/0*Ix_DMgBKNivG1etq." /></figure><p><strong>4) Opacity</strong></p><p>As its name indicates, the opacity property allows us to set the opacity or transparency of image, following this rule:</p><p><strong>img {<br> opacity: 0.5;<br> }</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/0*g3gAkT9hgGo0nLCG." /></figure><p>The lower the value, the more transparent the image will get.</p><p>We hope you found this information useful!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d62d7df9f1db" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>