Jump to content

Header formatting


c_paula
 Share

Recommended Posts

Hello,I've just started to use CSS and straggle with formatting headers.My problem is that when I format text by using h1,h2 ... it automatically create large space between the header and text or list that follow. So I use classes and paragraph to avoid that. Is there a way to change/control the spacing/padding between headers and followed content?See examplePaulina

Link to comment
Share on other sites

I find the extra space annoying as well. Its rather simply to work around:Here is an example I've recently used:

<style>/* header styles */h6{	font-size:8px;	color:#3399CC;	margin:0px 0px -15px 0px;}h5{	font-size:10px;	color:#3399CC;	margin:0px 0px -15px 0px;}h4{	font-size:12px;	color:#3399CC;	margin:0px 0px -15px 0px;}h3{	font-size:14px;	color:#3399CC;	margin:0px 0px -15px 0px;}h2{	font-size:16px;	color:#3399CC;	margin:0px 0px -15px 0px;}h1{	font-size:18px;	font-weight:bolder;	color:#3399CC;	margin:0px 0px -15px 0px;}</style>

Link to comment
Share on other sites

Why negative margins???If your header is immidiately followed by an element with no margin, the element will overlap on the header.The best way is to simply remove margins (though I'd personnally keep some, but not necessarily too much).

h1, h2, h3, h4, h5, h6 {   margin: 0;}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...