How can I use CSS to reformat the H4 tag?
I would like to reformat the H4 tag so that it when I use it it will put a blank line BEFORE itself but NOT after. However, I would like it to do a line break. i.e. most of the info comes to me thru Word documents. I would like to be able to copy/paste into my template and then highlight the "headlines", apply the CSS and have it reformat with a blank line above and then a keyboard return after. I tried creating a new style and playing with padding, margins, line spacing. . . I can't get it! Help please. OK, let me try this again. I receive a Word document thru email that needs to go on the website. I would like to be able to just copy from the Word document and paste it into my template for the web. However, all the formatting from Word is lost when I do this. . . SO . . .I would like to be able to then highlight a "heading" and apply a style to it. The style would tell it to increase font size, and weight, change font color AND put a <br> or equivalent after the heading so that the rest of the info is below it and not starting immediately after. Does this make sense. I realize I can key a <br> after each heading but if there is a way to include it in the CSS style it would be much easier. Again, I have tried padding, margins, line spacing, NOTHING seems to give me the <br> effect that I want. Thank you!
Public Comments
- The way to do this in CSS would be with padding or margin attributes. example: h4 {margin: 20px;} would add 20px margin to the H4 tag on the page. Padding works the same way: h4 {padding: 20px;} There are 4 settings for each in this order: top; bottom; left; right; There are also individual settings for each ... ex: h4 {padding-top: 20px;} or h4 {margin-top: 20px;} As far as a line return after, you're best bet is to just use a <br /> tag or use bottom padding/margin to accomplish this. If you want to stick with CSS, use the padding/margin settings.
- Sorry, but your question isn't very clear. Would you like a line break before the H4 tag. If so, why not just put a line break into your html: <br/> <h4>Header Four</h4> <p>Paragraph text</p> I don't know what styling an H4 tag has to do with Word documents. HTML uses plain text, simply with markups. (Microsoft) Word documents are formated text (ie, there is hidden formating for each letter...it's size, font, position and so on.) So HTML is used to make web pages, not to create word documents. The styling of word documents must be done within Word (perhaps Open Office or something similar...something that 'understands' it's formatting.) If you format a H4 tag with CSS for a web document you should be able to say: h4{ line-height:1em; padding:1em 0 0 0; margin:0; } the 1em of padding gives you the equivalent of one line of space above any h4 tag, the zeros are for the right, bottom and left padding. Margins should stay zero, but I guess that you could swoop around and use margins instead of padding, but different browsers could mess you around.
Powered by Yahoo! Answers