Solved HTML question

Frank1

New member
Power User
VIP
Local time
3:47 PM
Messages
394
Location
Ohio
I have a web page that I made some time ago using HTML 4.1. My page covers the entire width of the screen. On a lot of web sites I see now the page does not cover the entire width, and there is a small margin on either side with usually a light or no color. I like it that way. Does anyone know what code or tag I would use if I wanted to change my page so that there is about a 10 or 15% margin on either side of the page?
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Pavilion g7-1260us Notebook
OS
Desk Top with Win 7 Home Premium 64 bit and Lap Top with Windows 8.1 Pro 64 bit
Memory
8Gig
Screen Resolution
1600x900
It all depends on how the page is coded, is most cases you could probably get away with adding an inline style to the opening body tag with the % of width you want and auto margin to center.

HTML:
<body style="width:95%;margin:auto;">
 

My Computer

Computer type
PC/Desktop
OS
Windows 11
It all depends on how the page is coded, is most cases you could probably get away with adding an inline style to the opening body tag with the % of width you want and auto margin to center.

HTML:
<body style="width:95%;margin:auto;">
Thank you that did what I wanted to do. I enclosed it within my body tag as such:<body bgcolor="#ffffef" style="width:75%;margin:auto"> Now do you mind if I ask you one more question? The total page is all one color which is "#ffffef". Is there a way I can make the color of the margin different? If this answer will take too much detail to answer, that's OK if you don't answer. Thank you.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Pavilion g7-1260us Notebook
OS
Desk Top with Win 7 Home Premium 64 bit and Lap Top with Windows 8.1 Pro 64 bit
Memory
8Gig
Screen Resolution
1600x900
Not as simply as you did that, possibly you could leave the body at 100% then straight after the <body> tag have a <div style="width:95%;margin:auto;background: #000080;">

Then add a closing </div> before the </body> tag.

example
HTML:
<body style="background-color:#cccccc;">
<div style="background-color:#ffffff;width:95%; margin:auto">

Your content here

</div>
</body>
 

My Computer

Computer type
PC/Desktop
OS
Windows 11
Thank you. That worked.
 

My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
HP Pavilion g7-1260us Notebook
OS
Desk Top with Win 7 Home Premium 64 bit and Lap Top with Windows 8.1 Pro 64 bit
Memory
8Gig
Screen Resolution
1600x900
Back
Top