Skip to main content

Home/ Web Development, Design & Programming/ Group items tagged layer

Rss Feed Group items tagged

Soul Book

The Incredible Em & Elastic Layouts with CSS - 0 views

  • Elastic design uses em values for all elements. Ems are a relative size, written like this: 1em, 0.5em, 1.5em etc. Ems can be specified to three decimal places like so: 1.063em. “Relative” means: They are calculated based on the font size of the parent element. E.g. If a <div> has a computed font size of 16px then any element inside that layer —a child— inherits the same font size unless it is changed. If the child font size is changed to 0.75em then the computed size would be 0.75 × 16px = 12px. If the user increases (or decreases) text size in their browser, the whole interface stretches (or shrinks.)
  • All popular browsers have a default font size of 16px. Therefore, at the default browser setting, 1em = 16px.
  • The <body> inherits it unless styled otherwise using CSS. Therefore 1em = 16px, 0.5em = 8px, 10em = 160px and so on. We can now specify any element size we need to using ems!
  • ...9 more annotations...
  • However, (gasp) IE has a problem with ems. Resizing text from medium (default) to large in IE5/6 would lead to a huge increase in font size rather than the gradual one expected. So another selector is needed to get IE to behave: html{ font-size:100%; }
  • Let’s give our <body> some more style, and center everything in the viewport (this will be important later for our content wrapper.) Our initial CSS ends up like this: html{ font-size: 100%; } body{ font-size: 1em; font-family: georgia, serif; text-align: center; color: #444; background: #e6e6e6; padding: 0; margin: 0; }
  • 1 ÷ 16 × 740 = 46.25em (1 ÷ parent font-size × required pixel value = em value)
  • While we're here, we might as well add some typographic goodness by selecting a basic leading and adding some vertical rhythm, with everything expressed in ems.
  • Set a 12px font size with 18px line height and margin for paragraphs
  • Dividing the desired line height (18px) by the element font size (12px) gives us the em value for line height. In this example, the line height is 1 and a half times the font size: 1.5em. Add line height and margin properties to the CSS: p{ font-size: 0.750em; line-height: 1.5em; margin: 1.5em; } Now the browser will say to itself, “Oh, line height and margin is set to 1.5em, so that should be 1.5 times the font size. What’s the font size, again? 12px? OK, cool, make line height and margin 1.5 times that, so 18px.”
  • To retain our vertical rhythm we want to set an 18px line height and margin. Easy: If the font size is 18px then 18px in ems is 1em! Let’s add the properties to the CSS (and make the font weight light:) h1{ font-size: 1.125em; line-height: 1em; margin: 1em; font-weight: 300; }
  • Jon, good article and very useful chartm but your text sizing method has one major drawback. If elements with font-sizes set in em’s are nested, i.e with lists, these elements inherit the font size. Therefore each child element will be 0.75em (or 75%) of the previous one: See an example here. (Would have posted the code put it was coming out really ugly!) I would recommend against using that method and setting the global font size in the body tag i.e. 'font-size:75%' for 12px. Then only setting different font-sizes where necessary.
  • Thanks Will, interesting point, but that is solved with a simple font-size:1em on the first child. Retaining the default ensures that even images are sized correctly in ems. IE (surprise) will compute incorrectly against a parent length equivalent to 12px. My preference born out by some minor but painful computed size errors in complex layouts is not to adjust the body, and only set font size where necessary for specific elements.
  •  
    A nice and simple explanation of using EMs to make elastic layouts
steve waugh

DVD Case Mockup by graphickey | GraphicRiver - 0 views

  •  
    DVD Case Mockup
steve waugh

DVD Case Mockup by graphickey | GraphicRiver - 0 views

  •  
    DVD Case Mockup
wilkinsjones

Duties and Responsibilities of eCommerce Development Company - 0 views

eCommerce allows people to generate and, at the same time, provide online selling of items and services. A responsive and well-designed website catches the attention of the visitors and attracts th...

ecommerce-development-company ecommerce-web-design-company ecommerce-services

started by wilkinsjones on 08 Oct 20 no follow-up yet
timothypeverhart

Google Chrome for PC Latest Version - 0 views

image

Google Chrome

started by timothypeverhart on 24 Jul 23 no follow-up yet
Ashley Wilson

What is Kubernetes Orchestration - 0 views

  •  
    Kubernetes is an open source orchestration system for Docker containers to manage containerized applications in a clustered environment.
ailawyer123

AI layer - 0 views

  •  
    The author, recently diagnosed with stage IV cancer at 32, reflects on the sacrifices made for their legal career. They acknowledge the weight loss and fatigue they attributed to the demanding job, never considering a serious illness despite lacking traditional risk factors. Regret sets in as they contemplate lost friendships, missed trips, and strained relationships due to their relentless work schedule. Working long hours with the promise of a future with more free time after paying off loans, a goal achieved just a year ago, now feels like a hollow victory. While finding pride in helping others through their legal work, anger simmers at the immense cost. The author hasn't informed their parents yet, anticipating their usual joking response about the rarity of their calls. The purpose of sharing their story? A cautionary tale for others to prioritize a healthy work-life balance. This career, like many others, will consume as much time and energy as you allow, and reclaiming that balance is a difficult feat. Make those calls to loved ones, schedule doctor appointments, take vacations - create space for the other aspects of life that bring fulfillment. Edit: The author expresses gratitude for the well-wishes received during a dark time. While some advice, like using meth, was a humorous outlier, all messages were appreciated. They've quit their job, moved in with their parents to rebuild the relationship, and will begin treatment next week. Travel is a possibility after the initial treatment cycle. The message remains the same: make time for the things that truly matter. Links: Lawyer AI Assistant App (Android): https://play.google.com/store/apps/details?id=com.attorney.ai.assistant Lawyer AI Assistant App (iOS): https://apps.apple.com/us/app/id6478375502
balanceblind

Casinos with Tournaments: An Expert's Guide to Exciting Competitive Experiences - 5 views

Introduction As an expert in online casinos, I'm often asked about the different ways players can enhance their gaming experience and enjoy a dynamic environment. One of the most exciting options i...

started by balanceblind on 13 Nov 24 no follow-up yet
quanghieucorp

Stepdle - 1 views

What is Stepdle? When you respect Wordle more durable variant, Stepdle is the right decide for you. It is a easy game by which you need to guess a four-letter word, a five-letter word, a six-...

started by quanghieucorp on 04 Apr 25 no follow-up yet
‹ Previous 21 - 32 of 32
Showing 20 items per page