Bert Coules Posted November 19, 2014 Share Posted November 19, 2014 (edited) I mentioned in passing in another thread that for some reason <p></p> tags seemed not to be working in a simple HTML5/CSS website I was revamping offline. I've now found out why. I don't now now remember what the basis for the original files was, but for the redesign I was simply tinkering with them rather than starting fresh. I didn't notice (or didn't realise the significance of) one bit of code at the top of the style.css file: *{padding: 0px;margin: 0px;} This is labelled "Null Browser Defaults". When I experimentally removed those lines the paragraph formatting suddenly worked - presumably <p></p> uses padding and/or margins "behind the scenes" as it were. Unfortunately, the removal threw a lot of the other formatting out, so I'm going to have to rejig a good few things. But at least I have paragraphs. I've searched around but can't turn up exactly what Null Browser Defaults are and what those particular settings are for. Is the asterisk a sort of globally-affecting wild character? Edited November 19, 2014 by Bert Coules Link to comment Share on other sites More sharing options...
dsonesuk Posted November 19, 2014 Share Posted November 19, 2014 Browsers default margin and padding are not the same, so there can be different in appearance between these browsers. To make these more alike broswers margins and padding for all elements are zeroed using universal selector* {margin: 0; padding: 0;}Then the elements margins and paddings are reinstated to your liking, and all browsers will follow these rules instead of the browsers. Link to comment Share on other sites More sharing options...
Bert Coules Posted November 19, 2014 Author Share Posted November 19, 2014 Thanks for the reply. So does that mean that those lines should be at the top of all.css files? What about the effect on paragraph formatting? Link to comment Share on other sites More sharing options...
dsonesuk Posted November 19, 2014 Share Posted November 19, 2014 Yes, this is usually placed at the top. The effect on paragraphs is that there is no spacing to identify as a paragraph, it looks as though it is one big block of text with no paragragh at all, that is why you have to reset the paragraph margin to fix this, and other elements.For example*{margin: 0; padding: 0;}p {margin:0 0.9em;}This sets the margins for top and bottom edges of paragraph to 0.9em of font-size used.You then need to reset the margin for the other elements such as h1 to h6 and so on. 1 Link to comment Share on other sites More sharing options...
Bert Coules Posted November 19, 2014 Author Share Posted November 19, 2014 Ah, I wonder if that extra command was in the file originally and I inadvertently deleted it? In any case, I'll try the new coding this morning. Many thanks. 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