Hi,
I'm wondering if display:block can be used in a .css style to specify BOTH width and height of a div?
I once read that it's not good to specify both height and width for a div... And then I THOUGHT I read but with display block you can specify both h & w.
thanks.
Setting height can be a bad
Setting height can be a bad thing, but not always... depends on the situation. A set height tends to break the fluid nature of web browsers. If a user decides to set their browser text larger than your design and you have a set width, it can easily break the design.
A DIV is display block by
A DIV is display block by default. But don't use divs to show elements that have their own meanings. Use the appropriate semantic html tag for that. Overuse of divs is one of the worst things you can do on a web page but, alas, all too frequent.
Ed Seedhouse wrote: A DIV is
Tyssen wrote: Ed Seedhouse
A DIV is display block by default.
So are all these.
Yes, which is why I pointed out that overuse of DIVs is a real bad idea. Almost always you can find an element that describes the enclosed content better, and that's what you should use.
I had no idea
So display:block is the same as a div. Why is it sometimes included in a
I'm about ready to leave the float positioning and go back to tables! What do you think?
tebk77 wrote: So
So display:block is the same as a div.
NO it is not. DIV is defined by the W3C as being a "block" element but that can be changed in the CSS, though it seldom if ever should be.
"display:block;" is a CSS property, and has nothing directly to do with html.
Why is it sometimes included in a <div> stylesheet?
Because there are jillions of bad web designers putting pages up on the web?
I'm about ready to leave the float positioning and go back to tables! What do you think?
I think you are still "thinking tables" and that's where you're trouble mainly lies. You don't just switch from "tables to divs", that's nonsense and if someone told you to do that they were talking nonsense.
If you've been using tables for layout for awhile you can't just switch. You've picked up many bad habits that you must unlearn. The worst habit of all is using html elements for what they "look like" instead of what they mean. Write your html first in valid and semantic html and then and only then do your CSS to make the page look as you want it to look.
I suggest you put aside your knowlege of html and CSS completely for awhile and approach them afresh as if you knew nothing about them. Go to a site like HTML Dog and work through the tutorials, all of them, with a "beginner's mind".
It will save you many many fruitless hours of toil and trouble if you do. Your problem does not lie in what you do not know, it lies in what you think you know that actually isn't so.


