CSS (4)


Adding and using fonts

We have two options: Web safe fonts: Preinstalled on the computer. You simply specify the font-family in the css to use these. Web fonts: These are fonts added externally by adding downloaded font-files in the project. Using these is a two step process: Add the font-file to your project In your CSS head tag, use […]




Reset CSS and Normalize CSS

Often there is some guesswork involved when styling elements due to mystery spaces and padding appearing from heaven. These are due to default styling applied by browsers and can cause some confusion as they vary between different browser vendors. To remedy this, many leading developers in the frontend community have come up with two solutions: […]




Stacking order of elements in a layout

Lets take a look at this code: HTML:

CSS:

The natural staking order of elements in this piece of code is (in ascending order in the stack): The root element (<html>) .. this is at the bottom of stack..level 0 The viewport (<body>) Block level elements in the normal page flow block1 is […]




When to use Float vs Position vs Display for laying out elements and aligning blocks on page

Here are the recommendations: Float: Use this for content that flows around (i.e. variable and flexible content). A good example is an image surrounded by texts of different lengths. So even if the amount of text can change, but using float will allow it to flow around the image. Float is also very useful in […]