Introduction to CSS

Don't Use Height

Jen Kramer

AnnieCannons
Introduction to CSS

Check out a free preview of the full Introduction to CSS course

The "Don't Use Height" Lesson is part of the full, Introduction to CSS course featured in this preview video. Here's what you'd learn in this lesson:

Due to the many screen sizes used to browse the web, Jen advises against using the height property, as it will potentially prevent content from being visible.

Preview
Close

Transcript from the "Don't Use Height" Lesson

[00:00:00]
>> Jen Kramer: Alright now ,height in general in web pages is bad, bad, bad, bad. This is one situation where height is good because you have a background image and you need to be able to see it. But generally speaking, you don't wanna set height on your boxes in your web page.

[00:00:15]
Why would that be? Yeah.
>> off screen: Because there's a whole bunch of different media that people use to get on the website.
>> Jen Kramer: That's one reason. There's a whole bunch of media people are using to get on the website. There's a new device every day. You have no idea if your height is gonna work on all those devices, but there's more.

[00:00:32]
What else?
>> off screen: I read somewhere that you're only supposed to really adjust the width.
>> Jen Kramer: Yes.
>> off screen: Because otherwise things get too distorted.
>> Jen Kramer: It can potentially distort things, what else? You never know what people are going to do with their website. These days, the way we're building web pages right now, this is great for learning.

[00:00:51]
But these kinds of web pages where you're actually writing code and posting it online, this is actually something that's done less and less these days in web development. More and more you're using something like a content management system like Jumla or Wordpress or Drupal or you're working with a site like Wicks or Squarespace.

[00:01:08]
And what do people do when they have access to those things and they can put content in? They will put content in and they will put more content in. And they will put more and more content in and eventually that content will get very, very, very long. So if you've set a beautiful height and everything's all lined up and it looks lovely, inevitably someone will come along and put in more text and your whole design is gonna break.

[00:01:32]
So you want your design to be flexible and robust, so that it can adjust to whatever people do later in terms of putting content in web pages.

Learn Straight from the Experts Who Shape the Modern Web

  • In-depth Courses
  • Industry Leading Experts
  • Learning Paths
  • Live Interactive Workshops
Get Unlimited Access Now