background preloader

CSS

Facebook Twitter

CSS: Stretch a Box to its Parent's Bounds - Devign. Not so famous, yet powerful feature of absolute positioning is stretching a box. Absolute positioning lets us having a box positioned according to the bounds of the closest relative/absolute/body parent (also known as offset parent). The most popular use is having a box positioned in either top or bottom and right or left coordinates, and the dimensions of this box are defined by its inner content or a specific width/height. Example #1 - Absolute Inside Relative, With Fixed Dimensions “`html But what if you don’t know the dimensions of the parent, or don’t want to maintain the pixels twice on both parent and absolute child? A height:100% value can be applied only for specific situations: The inner box should be the exact same height as its parent, start at the top and end at the bottom, no offsets.

The Solution Example #2 - Absolute Inside Relative Without a Specific Height: The Absolute Stretches to the Relative’s Bounds xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx What is it Good For? CSS: Stretch a Box to its Parent's Bounds - Devign. Image slider without JavaScript. What’s with putting the CSS in the head? — Coding & Design. Throughout my development years, the default practice has been to place all CSS in an external minified CSS. Then place this CSS file on a CDN, which would help improve loading time by hosting this file on multiple servers, one of which maybe geographically closer to the user and thus load quicker (reducing latency).

That said, there’s a growing discussion and practice around placing the CSS within the head of an HTML page. You are probably thinking, what? To understand the logic behind this we need to understand how a browser works. Although there are differences from browser to browser, the fundamentals are the same. When a HTML page is loaded on a browser — the browser makes the network call which then returns a response. Critical is the path from the user following a link to the first impression and then the working experience .

So the critical path essentially relies on three factors: The HTML, CSS and the Javascript. As you can see it takes 378ms to load. 7 ways to make your portfolio sing | Portfolios. Web Design Weekly #125. Headlines Optimising Web Font Rendering Performance Just because the page is using a web font, or several, doesn’t mean it will (or has to) render slower. A well optimised site can deliver a better and faster experience by using web fonts. In this article Ilya Grigorik explains how. (igvita.com) The Design Kickstarter Bundle (400+ items) Full of more than 400 different pieces, you’ll get loads of new textures, Photoshop brushes, vector elements, swoosh typefaces, Photoshop action sets, and more! Articles Is putting the CSS in the head a good idea?

Hans Christian Reinl explores the downsides of placing CSS in your HTML head instead of referencing external files. Sass: Mixin or Placeholder? A clear and concise article by Hugo Giraudel which should help clear up not only what mixins and placeholders are for, but also when you should use them and what effect they will have on the compiled CSS. Don’t use flexbox for overall page layout Introducing “subhead” Getting Started With Pattern Libraries Jobs. CSS Colours - A list of colour names in CSS.

25 CSS3 Code Snippets for Making 3D Animated Effects. Web developers have been immersing themselves into CSS3-based designs. Transition animations along with CSS keyframes have opened the door to many possibilities. 3D animation was never optimal outside of Flash-based websites. However the further advancements in JavaScript along with CSS3 have created a new code toolbox for web designers. I’ve put together a number of fantastic open source code samples using 3D animation effects. Many rely solely on CSS3 while others are a mix of CSS and JavaScript. Keep in mind that people using older web browsers may not be able to fully appreciate your 3D animations. But that doesn’t mean you should ignore the practice! As more people upgrade to newer browsers there will be greater support in the years to come. Navigation Bar Foldable Tab Bar Digital Book Preview Windows 8 Metro Animations CSS 3D Solar System Direction-Aware 3D Hover 180 Transformation Ranged Price Slider CSS-Only MacBook Air Animated 404 CSS 3D Animated Chart Text Perspective 3D Gallery Display.

Not Using CSS Preprocessors? You Should Be. CSS was both a wonderful innovation and a missed opportunity. Being able to separate the form and the content of a webpage massively improves the process of web design. But, CSS has a number of limitations. As anyone who has ever written CSS knows, for all but the most simple of sites, the CSS can become a tangled mess of repetitions, overrides of previous CSS, and overrides of overrides. CSS does not conform to coding best practices, and its simplicity steps over the line from simple to simplistic, frequently hindering the design and development process. Thankfully, CSS preprocessors provide us many of the features that would ideally have been included in CSS from the beginning.

Image by Naiara Abaroa What Is A CSS Preprocessor? Put simply, CSS preprocessor languages are more feature-rich than CSS alone and can be processed into CSS that works as normal. As the name suggests, CSS preprocessors take a text file, process it, and output correct CSS. Variables, Mixins, and Functions 688 shares. La propriété border-image en CSS3.

Par Estelle Weyl Bien que ce ne soit pas vraiment une nouveauté pour les navigateurs, la propriété border-image est désormais disponible dans la spécification CSS3. border-image (littéralement : image de contour, NdT) offre une méthode pour ajouter des contours décoratifs à n’importe quel élément. Avec les propriétés de border-image, vous pouvez créer des contours décoratifs pour des éléments qui vont bien au-delà des simples coins arrondis, avec des images très légères ou même avec des dégradés. La propriété border-image vous permet de prendre une petite image, de la découper virtuellement en neuf tronçons, et de disposer ou d’étirer les morceaux de votre petite image au sein d’un autre élément beaucoup plus grand. Vous pouvez prendre une image et l’étirer sur toute la largeur d’un bouton ou d’une page entière.

Dans ce second exemple, au lieu d’étirer le milieu de l’image de contour, nous l’avons répété. La propriété border-image est un raccourci qui permet de déclarer : border-image-width. What No One Told You About Z-Index — Philip Walton. The problem with z-index is that very few people understand how it really works. It’s not complicated, but it if you’ve never taken the time to read its specification, there are almost certainly crucial aspects that you’re completely unaware of. Don’t believe me? Well, see if you can solve this problem: The Problem In the following HTML you have three <div> elements, and each <div> contains a single <span> element. Each <span> is given a background color — red, green, and blue respectively. Here’s what the HTML and basic CSS look like. <div><span class="red">Red</span></div><div><span class="green">Green</span></div><div><span class="blue">Blue</span></div> Here’s the challenge: try to see if you can make the red <span> element stack behind the blue and green <span> elements without breaking any of the following rules: Do not alter the HTML markup in any way.

To see if you can figure it out, click the edit on Codepen link above and play around with it for a bit. The Solution Stacking Order. Putting CSS Clip to Work: Expanding Overlay Effect. A tutorial about how to create a simple expanding overlay effect using the CSS clip property and CSS transitions. View demo Download source Our previous article, Understanding the CSS Clip Property by Hugo Giraudel offers a great overview of the CSS clip property and the rect() function. Today we want to explore the practical side of it a little bit more. We are going to create a neat and simple effect for revealing some extra content and expanding a fullscreen overlay. We want to show how to leverage the CSS clip property to make a smooth transition when clicking on a box element.

The idea is to show some kind of overlay as if it’s actually underneath the respective element. This is how we’ll do it: we will first create a list of items that will look like metro-style boxes: Each one of the boxes will contain an element (overlay) that will be of position fixed. Clicking on the close button will reverse the effect and the overlay will minimize to the list item’s size and disappear. The CSS. Typesetting Responsive CSS3 Columns. Multi-col­umn lay­outs are awe­some, but I haven't seen many great im­ple­men­ta­tions. This is my try. Tommi Kaikkonen on January 7th, 2013 Be­fore you start read­ing this ar­ti­cle, you might want to play with the check­boxes in the top right cor­ner.

Re­size the win­dow. Zoom in and out. Where Are the Columns I use a Full HD widescreen for brows­ing the in­ter­net. CSS3 columns have de­cent im­ple­men­ta­tions in browsers. Let's be­gin with an overview of how CSS3 columns work. CSS3 Columns CSS3 columns take con­tent and di­vide it into columns based on ei­ther the column-width or column-count CSS-prop­er­ties. For ar­ti­cles, there's one vi­able op­tion: column-width. Us­ing column-width cre­ates new columns to the right as con­tent ex­pands. Full Justification Ad­ja­cent and nar­row columns need full jus­ti­fi­ca­tion to look good. Cross-Browser Hyphenation with Hypher.js Working Out the Kinks I en­coun­tered a prob­lem with the width of col­umn con­tain­ers.

Set Column Gap to Zero. How to Use Icon Fonts in Your Website. Icon fonts are quickly becoming a web design trend and there is a good reason for that. Creating icons with icon fonts gives designers the ability to manipulate the icons with CSS. The days of creating two different icon images for rollovers or effects are long gone. Now we can easily change color, size, and even animate the icons just as we would most other HTML elements.

Aside from giving designers and developers more control, icon fonts also offer many features that bitmap image icons simply do not. Because the icon is a font, it has the same properties as all other fonts. That means it is completely vector and scales perfectly no matter the size. Here is a demonstration of how icon fonts look scaled up compared to bitmap icons. As you can see, the bitmap icons get pixelated while the vector font icons scale up fine and look as sharp and precise as they did in a smaller size. One other advantage we get with icon fonts is load time. Step 1: Load The Font via @font-face Other Methods. Using CSS Pseudo Elements :before And :after. The CSS pseudo elements, :before and :after, have been around since IE8.

So, this is probably not news to many of you. But, for me personally, I just started using the :before and :after pseudo elements and I've been absolutely loving them! They making it much easier to keep design-centric elements out of your markup and in your CSS (where they belong). Anyway, I thought I'd put together a quick demo in case anyone else is late to the party.

The CSS pseudo elements, :before and :after, prepend and append content to the selected elements, respectively. ... or it can be a URL to an image: If you don't want to render any content, you can use the empty string; but, you must supply the "content" property in all cases. These pseudo elements don't show up in the DOM. That said, here's a quick demo of the :before and :after pseudo elements in action: According to the HTML markup, there's nothing but a button with the text, "Button. " This "NEW" tag was supplied by the :before pseudo element. Lingering Misconceptions on CSS Preprocessors. I recently received this email from a reader who is just getting started as as front end developer and wanted to get into CSS preprocessing. It has a few common misconceptions in it that I hear quite often. So, blog post. I'm still not keen on LESS. The fact that it requires adding more JavaScript to my pages puts me off. Sass seems a lot more user friendly.

Let's start with this one: I'm still not keen on LESS. LESS is written in JavaScript. The "pre" part of preprocessing you can think of as "before you send these files to the live website. " When the speed of LESS vs. And then this one: To install Sass I needed to install Ruby, and to install Ruby I needed to install git, and to install git I needed to install the oskeychain helper... Oi! Share On. 2013 Work Plans.

I've got some ambitions plans for CSS this year, and I thought it would be useful to get them out there and socialize them before I start working on them in earnest. My overriding goal this year is to pursue generative solutions to problems. CSS has a complexity problem, and I've been tackling it from the sides for a while, but my approach doesn't scale. If CSS is supposed to grow out to satisfy all the demands that people put on it, our current modus operandi is insufficient. We too often solve the specific problem in front of us, too scared of overreaching to solve a more generic instance of the problem. This makes CSS a hodgepodge of well-designed (when we're lucky) but overly-specific solutions, which increases the complexity debt. So, what does that mean for CSS? Animations CSS Animations are great, when your problem is shaped exactly like the problem they were designed to solve - a static animation known at page-load time.

I'm trying to fix this in a few ways. Layout Polyfills. All you need to know about CSS Transitions. CSS3 transitions bring simple and elegant animations to web applications, but there’s a lot more to the spec than first meets the eye. In this post I’m going to delve into some of the more complicated parts of CSS transitions, from chaining and events to hardware acceleration and animation functions. Letting the browser control animations sequences allows it to optimize performance and efficiency by altering the frame rate, minimizing paints and offloading some of the work to the GPU. Browser support CSS transitions are supported in practically every version of Firefox, Safari and Chrome.

They’re supported in IE 10 and onwards. Webkit based browsers (Safari and Chrome), still require -webkit prefixes for animations and gradients, but these are soon being removed. Applying transitions A simple way of applying transitions is with CSS pseudo-classes, such as :hover. Duration is the only required item in the transition shorthand. Transitioning gradients Hardware acceleration Clipping Redrawing. Coding Q&A: CSS Performance, Debugging, Naming Conventions. Advertisement Howdy folks! Welcome to another round of Smashing Magazine CSS Q&A — the final one, as of now. One more time, we’ll answer the best questions which you sent us about CSS. It was a great experience to run this Q&A with you – thanks a lot for sharing all your questions with us!

We hope we answered them at the best possible, and we’ll surely be back with new and exciting Q&A rounds in the future. Enjoy Chris’ last round on CSS performance, best practices on CSS class naming, and more! CSS Performance Vitaly asks: “Could you recommend some rules of thumb or general tips on how to improve the performance of CSS? Most of the time, I don’t think you should even bother thinking about the performance of your CSS. The first thing to check is your website’s response time. CodePen rocks a respectable 216 millisecond response time. Usually, that’s not the problem with slow websites.

You can learn more about these things in this slide deck3 that I’ve put together. Naming Classes (al) Understanding the CSS Clip Property. The Absolute Beginner's Guide to Sass. Le BlogDuWebdesign boost l'inspiration des intégrateurs #4 - inspiration-integration. 20 Web Designs That Look Like Animated Infographics. Learning SASS: A Beginner's Guide to SASS. Improving text selection in CSS Regions – take 2 | Web Platform Team Blog.