Height not working

Good evening,
Im trying to seperate two CSS Divs with a gap inbetween:-
          <div style="width:310px; height:1px; float:left; background-color:Green;"></div>

Which works great, apart from it makes a massive line across the page, instead of 1px. Ive tried max-height but it still displays a big bar :-(

How can I change it to display a thin gap (Im going to remove the "background-color:Green" eventually, just wanted to see it on the page)

Any ideas?

Thank you
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sudaraka WijesingheWeb Application ProgrammerCommented:
HTML/CSS code you posted here alone will show a thin (1px) line, but your page could have styles defined on DIV tags with height or padding. Try setting the padding to 0.
tonelm54Author Commented:
Ok, so have tried:-
<div style="width:310px; height:1px; float:left; padding:0; margin:0; background-color:Green;"></div>

But still displays a large green line (see image)
 Screen Shoot
Dave BaldwinFixer of ProblemsCommented:
It looks like you have another <div> floated left against the first one.  That will affect the height that you see.

It would be better if you showed the whole page code.  This things are not independent of each other.
Mark StegglesWeb DeveloperCommented:

"Im trying to seperate two CSS Divs with a gap inbetween:-"

There is a css property called margin which was designed to create space between elements.. this is the correct way to do it.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.