How to margin the body of the page (html)?

后端 未结 8 1712
萌比男神i
萌比男神i 2020-12-15 18:14

I used the following


which works only on IE6. I want it to work with firefo

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-15 18:41

    Yeah a CSS primer will not hurt here so you can do two things: 1 - within the tags of your html you can open a style tag like this:

    
    

    2- the above though will only work on the page you have this code embeded, so if if you wanted to reuse this in 10 files, then you will have to copy it over on all 10 files, and if you wanted to make a change let's say have a margin of 5px instead, you would have to open all those files and make the edit. That's why using an external style sheet is a golden rule in front end coding. So save the body declaration in a separate file named style.css for example and from your add this to your html instead:

    
    

    Now you can put this in the of all pages that will benefit from these styles and whenever needed to change them you will only need to do so in one place. Hope it helps. Cheers

提交回复
热议问题