I am new to using <div> for web page layout, and seem to be having a problem with positioning some <div>'s in line (horizontally) within an existing <div>. I tried display; inline; however that seems to remove the width control and margin, which i need to maintain. currently the relevant code is:
Yeah, I would agree that it is not a good name for div class. Even though you could name it anything you like it is bad practice to confuse it with a completely different html element.
For the same reason we discourage people from using .active as a class name for current page highlighting in menus. :active is actually a pseudo class and when you mix it in beside a class name (of the same) it becomes confusing.
Dibley, you said you were new to div layout so we can cut some slack, just don’t start naming your divs like they were tables. Give them names that are descriptive to what they are doing and the purpose they serve.
Okay fair enough, I presume you’re referring too, that this might be tabular data, since the other div’s names are .house_name and .house_number. But like he mentioned, he’s new to CSS, so why not just tell what you think he’s doing wrong instead of just saying this is bad?
One problem people have coming from tables to non-tables is they often try to replicate the tables with divs.
There are like 94 HTML tags out there, so if everything is a div it’s automatically suspicious.
The way out is to start with the text content first, then start marking it up with what the content is. This isn’t easy for someone coming from tables either but I think it pushes them in a better direction.
After the page is marked up to satisfaction, take a look at what you have now in a browser (or all browsers). Then you’ll be using the minimal amount of CSS to push boxes into place with floats, margins, etc, rather than trying to labouriously and meticulously position everything (that’s going to be a lot of code, as you can see with each element being absolutely positioned, and it’s brittle).