I have a table with td width of 1px and works ok. but when I am trying to do the same with div It seems that I wouldn't accept 1px. it looks something about 3 px or so. I change the font size to 1px as well but it didn't work.
am I doing something wrong?Why would you even want a <div> to be 1 pixel wide!?div.1px {
height: 1px;
font-size: 1px;
line-height: 1px;
background-color: blue;
border: none;
padding: 0;
}Make sure you don't have any padding or margin applied to it. But yes, I ask as well, why would you need a 1px wide <div>? Surely you can use margin, padding, or the like to accomplish what you want? Seems like unneccesary markup.or use a border
height in the title, width in the content. hmm, strange!Thanks NogDog
Your code worked fine.
But I was going to answer friends here and noticed that their question was the answer for me. Actualy I wanted to create a line with the height of 1px. When I wanted to type the answer here I thought "well I could have used <HR>, Why should I insist of using <DIV>"
Thanks for your question.
am I doing something wrong?Why would you even want a <div> to be 1 pixel wide!?div.1px {
height: 1px;
font-size: 1px;
line-height: 1px;
background-color: blue;
border: none;
padding: 0;
}Make sure you don't have any padding or margin applied to it. But yes, I ask as well, why would you need a 1px wide <div>? Surely you can use margin, padding, or the like to accomplish what you want? Seems like unneccesary markup.or use a border
height in the title, width in the content. hmm, strange!Thanks NogDog
Your code worked fine.
But I was going to answer friends here and noticed that their question was the answer for me. Actualy I wanted to create a line with the height of 1px. When I wanted to type the answer here I thought "well I could have used <HR>, Why should I insist of using <DIV>"
Thanks for your question.