Link to home
Create AccountLog in
Avatar of tonelm54

asked on

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
Avatar of Sudaraka Wijesinghe
Sudaraka Wijesinghe
Flag of Sri Lanka image

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.
Avatar of tonelm54


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)
 User generated image
Avatar of Dave Baldwin
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.
Avatar of Mark Steggles
Mark Steggles
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account