rain13 Posted December 29, 2012 Share Posted December 29, 2012 (edited) Hello. How can I make h2 only as tall as needed? In other words how do I minimize h2 height? <div><h2>heading 2</h2>abcd</div> Left side of image is as it is now. Right side of image is how I want it to be. Edited December 29, 2012 by SoItBegins Link to comment Share on other sites More sharing options...
davej Posted December 29, 2012 Share Posted December 29, 2012 Seems like you want to reduce the margin and padding. <html><head><style>.nm {margin: 0;}</style></head><body><div><h2 class="nm">heading 2</h2>abcd</div><div><h2>heading 2</h2>abcd</div></body></html> Link to comment Share on other sites More sharing options...
rain13 Posted December 30, 2012 Author Share Posted December 30, 2012 Thank you. Link to comment Share on other sites More sharing options...
Robertmw Posted December 31, 2012 Share Posted December 31, 2012 (edited) You should use a CSS reset every time html, body, div, span, applet, object, iframe,h1, h2, h3, h4, h5, h6, p, blockquote, pre,a, abbr, acronym, address, big, cite, code,del, dfn, em, img, ins, kbd, q, s, samp,small, strike, strong, sub, sup, tt, var,b, u, i, center,dl, dt, dd, ol, ul, li,fieldset, form, label, legend,table, caption, tbody, tfoot, thead, tr, th, td,article, aside, canvas, details, embed,figure, figcaption, footer, header, hgroup,menu, nav, output, ruby, section, summary,time, mark, audio, video {margin: 0;padding: 0;border: 0;font-size: 100%;font: inherit;vertical-align: baseline;}/* HTML5 display-role reset for older browsers */article, aside, details, figcaption, figure,footer, header, hgroup, menu, nav, section {display: block;}body {line-height: 1;}ol, ul {list-style: none;}blockquote, q {quotes: none;}blockquote:before, blockquote:after,q:before, q:after {content: '';content: none;}table {border-collapse: collapse;border-spacing: 0;} This is an example Edited December 31, 2012 by Robertmw Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now