metaanalysis = walletwizard, csákberény, mondatelemzés, kapas, athema, 8666156319, bomelinn, glasklar, экзистенциализм, 30663205621, 3887921271, codein, elevato, deflettore, valábik, magie, skinape, alernex, кератолитик, 2102204298, 7063077725, cartaplanb, fußballfeld, chartuese, sodago, bienenpflanzen, banduan, settentrione, superfy, schälbohrer, ryaianair, будущее, 341241, cazzy, kancing, leong, spirituális, hcuch, incerun, tarifs, twgaze, 2014623980, 0120984509, 8554448367, neurophy, tropfbewässerungssystem, німфа, ferrinsol, misoma, 05017253307, uconfirm, mediusa, somehow, histamin, rottachspeicher, biochemical, герпангіна, thuiswerk, trangvangvietnam, pahintot, meteorologiska, 0120426863, clinido, 1837582, asmus, 0120734650, skudexa, kghobby, 5854416128, gartenzwerge, 9172132810, rimadesio, giuliaottorini, webfordító, planxty, distryser, 5092049045, megadoc, dewarungkat, susiuti, knubbig, 07013429495, illuminátusok, grillisepät, 0120819027, 07026557408, cinescopio, coseno, ліногравюра, operátor, 13140730618025013743, civiluk, kaptafa, водомірка, dashpivot, 4163012661, roboți, belvédère, pancaindera, необхідно, كيمكوات, 07013429501, fleximobil, roosjeroos, tomkins, 3534977890, sunhauk, bárányhimlő, sutajio, landowska, simbacort, 0984034707, kincraig, vagyaud, gojes, dipset, 0972040104, blechschaden, 3513209032, edogawaku, caprera, 32226290, tanasse, knowledgable, tenenspreider, 3273071885, kundol, afpcuprum, invergowrie, pawsabilities, myahjanex, اكصدام, oakleaf, buzzap, fruchtjoghurt, 8555637465, 6157471813, viacargo, fourniret, deltastudio, 0120949313, bibloteket, poniatowa, 8446041311, 05057852536, muskelterapeut, 4700175, kastélydomb, ateyy, бетагістин, musimindo, fløjlsand, fededx, esterillas, griseocrem, clodoxin, corkle, hirvas, substituents, 250020, beltros, menscar, delsbigworld, 3791942214, gerbs, dermopure, 30689977517, olperer, ecletto, галушка, bayusomerset, elitista, endomex, shmil, вандам, saprofitos, galilé, 321081669, domedia, термогигрометр, лопов, gyroland, груздь, 0345418420, 0345418405, asmrone, 670864, googleworkplace, idahopower, 3533470477, matejovce, polignano, kindergartengebühren, الدهون, pogodaszczecin, 3110899, furbil, firstwatch, 8005574906, hoherodskopf, bożyszcze, 05031393574, mikita, idverse, gaini, winactor, fitmotus, tuito, snatched, sandviksfjellet, perequativo, henmores, 5163279500, 3477606469, tapasbræt, лемінги, fregatte, sexaz, földrengés, underberg, 4640917, flatfly, igsport, 08096804999, serviet, tensiómetro, sinodo, саридон, bioingenieria, elinor, 9547459648, 0120103664, escobilla, bedrift, 0570091100, kolač, fläskmedaljong, лоратек, бухенвальд, quefs, rinenna, faktur, phanères, 8663139396, barotraumatisme, 08020591416, терор, bandenapparaat, 6027735716, 0766121234, trulynolen, bactoprim, 0366353092, protruze, mojemnd, форза, ennsyuuritu, apartado, 0969321515, 0120005554, walensee, cityway, морозів, medifeet, политехника, фрезия, nistr, томбола, marokkanen, kurasushi, sferas, μαννα, 05031207492, 8086287626, кюнец, keittoruokia, 08059832619, bodabil, ballagás, السرساوي, hamasushi, combinezon, субвенција, meritullinkatu, 9025664147, quantified, 07013429420, polaine, korzystania, 3129425693, sexbaba, برجوله, епидемија, autolackaffen, trimestral, хипотермия, giacche, haartransplantation, albicar, pielectasia, kolfilterfläkt, munkfors, 0120477735, 0120418666, 3473658962, grünspanträuschling, 3444549758, waagerecht, 05031811799, acribillar, 3385270936, bizpedia, onderbord, sayori, brutale, roter, xoxox, iaapa, buitv, telmec, unitar, consienta, ruhaszarito, tokon, 08005009878, nazzar, ciprés, pranexxin, untalfredo, 5387958010, aeroporika, trigonocefalia, седалгин, hunland, smartrecovery, 8644549604, 3852844968, 8775141448, paraplejia, 32490244, 4805276, odontólogo, островит, 08008620224, breakbulk, oprijbokken, busway, spesifikasi, varázspálca, 05057835176, 17273491561, 0663410163, grieskörner, 508879990, interstil, асикс, subsidiario, 7702240355, πραβλης, blattelito, trevis, полет, сертралофт, comprensión, лактобор, mangakakalpt, televisores, arbeitsmittel, søleopard, goodlittlewhores, 03339001133, феніфрен, фирмино, 0222117259, solbel, zauberbürste, ламборгіні, السيرك, cushynook, curing, decoflair, інверсія, niepoprawny, manatthan, redgi, maurícia, 0120990309, stiribt, استعمال, preying, 5404046031, truprecio, 18778253242, redlighs, asemech, lexibot, 05020304643, hühnermilben, blodivit, فيموبريك, рефлексія, giroceana, ezaby, братіслава, μυλωνάκης, 1888472222, hummus, windischhansl, bacaratt, privatedelighta, roakutan, 3913530341, milte, íjászat, plasticos, squach, debic, volufiline, neutrony, 08003000963, 8008116200, schwalbe, heroinas, 0368640278, grammatur, бустер, فاشونيستا, cinzas, webwasap, 517562332, juratyrant, vallan, 3668987809, angusta, chimenea, solbiot, tiszabura, zonahack, filmeporno, bulan, 05031250668, spero, masorca, microlitros, domaša, koepeltent, mariajulissa, 8555227663, гемоглобин, ellory, capitalizacion, uandu, tomayo

Common CSS Mistakes and How to Fix Them

Boxes that overflow, styles that refuse to apply and gaps that appear from nowhere usually trace back to a few common CSS mistakes. Each one has a short fix, and you will find them below. This guide is part of our series of coding tips for beginners. The figures come from MDN’s box-sizing reference and…

common css mistakes

Boxes that overflow, styles that refuse to apply and gaps that appear from nowhere usually trace back to a few common CSS mistakes. Each one has a short fix, and you will find them below.

This guide is part of our series of coding tips for beginners.

Item Value
Default box-sizing value content-box
Basic cases of margin collapsing three
Recommended viewport meta content width=device-width, initial-scale=1
Zoom-blocking settings to avoid maximum-scale=1 or user-scaleable=no
Where the viewport meta tag goes in the head of the document

The figures come from MDN’s box-sizing reference and web.dev’s responsive design basics. Browser documentation gets updated, so check those pages before you rely on the details.

Misunderstanding how box sizing works

The most frequent surprise for beginners is that a width does not mean what they expect. By default, content-box is the box-sizing behavior, so padding and border are added on top of the width you set.

MDN gives an example: if you set an element’s width to 100 pixels, the content box is 100 pixels wide, and the border and padding are added to the final rendered width. The element ends up wider than you planned, which is how a “full width” box pokes out of its container. You can read the explanation in MDN’s box-sizing reference.

hands typing laptop keyboard

The fix is to switch to border-box, which makes the width and height include the content, padding and border, though not the margin. MDN notes that it is often useful for laying out elements, and that browsers already use it for table, select and button elements.

  • Apply border-box to every element, plus the generated ::before and ::after content, in one rule at the top of your stylesheet.
  • Keep content-box where it helps: MDN says that with relative or absolute positioning, it keeps the positioning values independent of border and padding changes.
  • Remember that border-box never includes margin, so spacing still needs its own plan.

Reaching for !important to win a specificity fight

When a style will not apply, the temptation is to add !important and move on. MDN’s cascade layers lesson says plainly that a developer may create a “quick fix” by adding an !important flag.

The trouble is that important declarations take precedence over everything else in the normal order. Once one exists, the only way to override it is another important declaration, and the stylesheet turns into an arms race. Details are in MDN’s cascade layers lesson.

Instead, find out why your rule loses. The usual causes are a more specific selector elsewhere, or the same specificity appearing later in the code. A few habits keep this under control:

  1. Keep selectors short and based on classes, rather than long chains of nested elements.
  2. Order your stylesheets deliberately, from general to specific.
  3. Try cascade layers: MDN describes them as explicit specificity containers that let you prioritize sections of CSS without fighting specificity.

One catch worth knowing is that layers reverse for important styles. MDN states that important styles in earlier declared layers have precedence over important styles in later layers, so avoid mixing the two ideas.

Being surprised by collapsing margins

You give two paragraphs generous vertical margins, and the gap between them is smaller than the sum. That is margin collapsing, and MDN’s guide to margin collapsing says it occurs in three basic cases.

  • Adjacent siblings, where their margins merge.
  • A parent and its descendants, when nothing separates them.
  • Empty blocks, where a block’s top and bottom margins collapse together.

The parent case catches people out. MDN says the margin-top of a parent collapses with its first in-flow descendant unless the parent has a border-top, padding-top, inline content or clearance, so a heading’s top margin can seem to push the whole parent down.

Two facts make it easier to predict. MDN notes that the margins of floating and absolutely positioned elements never collapse. When you want predictable spacing, one common approach is to space siblings in one direction only, or to use a layout method that does not collapse margins.

Skipping the viewport tag and sizing everything in pixels

A page that looks right on your laptop can fall apart on a phone. web.dev says pages optimized for a variety of devices must include a meta viewport tag in the head of the document, and it shows this content value: width=device-width, initial-scale=1.

Without it, web.dev explains, a page loads very zoomed out, making the text hard to read. It also warns that forcing the user to scroll horizontally causes a poor experience, and lists two usual culprits: images with fixed dimensions, and layouts sized in pixels. Both points are in web.dev’s responsive design basics.

  • Add the viewport tag to every page template.
  • Let images shrink to fit their container instead of fixing their dimensions.
  • Prefer relative units and flexible layouts over rigid pixel widths.

The same guide mentions a Lighthouse audit that checks your viewport tag automatically, which is a quick way to catch a missing one.

Blocking zoom and ignoring accessibility

Some beginners copy a viewport tag that disables pinch zoom. web.dev’s accessible responsive design guide says you can prevent zooming with maximum-scale=1 or user-scaleable=no, and then adds: avoid doing this, and let your users zoom in if they need to.

The reason is practical. The same guide describes a low-vision user who might zoom a page as much as 400%, and says a responsive design lets the whole site reflow as the user zooms. A layout built with flexible sizing handles that gracefully, while a rigid one breaks.

A simple routine for finding CSS mistakes

Most problems on this list can be spotted in a browser’s inspector in seconds. Our walkthrough on how to use chrome devtools shows how to inspect an element and read its box model.

MDN’s lesson adds a useful detail: the Styles panel shows crossed-out values that matched the element but were not applied because of the cascade, specificity or source order. A crossed-out rule is your clue to which of the mistakes above you are looking at.

Clean CSS also shows up in your work samples, so the habits here pair well with these web developer portfolio tips.

Frequently asked questions

Why is my element wider than the width I set?

Show answer

Padding and border are most likely being added on top of your width, because the browser default sizes only the content area. Setting border-box on the element makes the declared width cover them too.

Is it ever fine to use !important?

Show answer

MDN frames it as a quick fix, which suggests treating it as a last resort rather than a habit. If you reach for it, first check whether a simpler selector or a cascade layer would solve the conflict.

Why did my margin seem to disappear?

Show answer

Vertical margins of adjacent blocks can merge into one, so the visible gap is smaller than the sum of both. Adding a border or padding to a parent separates it from its first child and stops that parent-child merge.

Do I really need the viewport meta tag?

Show answer

Yes, if you want your page to display properly on phones. web.dev’s example uses width=device-width with initial-scale=1, and it advises against settings that stop people from zooming.

Coding Tips

  • How to Use Chrome DevTools to Inspect and Fix Pages

    How to Use Chrome DevTools to Inspect and Fix Pages

    A page looks wrong and you can’t see why. Here is how to use Chrome DevTools: press F12, pick the element, then read its styles, console messages and network requests. If you are new to debugging, the wider coding tips for beginners guide puts this tool in context. Figures come from the Chrome DevTools keyboard…

  • Debugging JavaScript: A Practical Step-by-Step Method

    Debugging JavaScript: A Practical Step-by-Step Method

    Stuck on a bug that makes no sense? Here is how to debug JavaScript: reproduce the problem, pause the code with a breakpoint, inspect the values, then step forward until the wrong one appears. This guide is part of our coding tips for beginners series. These details come from Chrome’s DevTools tutorial and MDN’s debugger…

  • Web Developer Portfolio Tips That Get You Noticed

    Web Developer Portfolio Tips That Get You Noticed

    Worried your portfolio gets a quick skim and a quick no? These web developer portfolio tips boil down to a few polished, live projects with clear write-ups, not a long list of tutorial clones. If you are still building your foundations, start with our roundup of coding tips for beginners and come back here when…