Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › Fixed container dimensions?
New Posts  All Forums:Forum Nav:

Fixed container dimensions?

post #1 of 12
Thread Starter 
I'm using a custom image to be the background of the container, but much of the image isn't revealed until I enter content or hit enter a few times placing non-breakable spaces.

Is there anyway I can set container to be a fixed set of dimensions so it's all revealed and I can add my content after the fact? I'm aware that a while back, IE users would have issues when creating fixed containers, causing overflow and so on. Is this still the case?

This is the code I'm working with:
Code:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
        font: 100% Verdana, Arial, Helvetica, sans-serif;
        background: #000000;
        margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
        padding: 0;
        text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
        color: #000000;
}
.oneColFixCtrHdr #container {
        width: 780px;  /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
        background: #FFFFFF;
        margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
        border: 1px solid #000000;
        text-align: left; /* this overrides the text-align: center on the body element. */
}
.oneColFixCtrHdr #header {
        background: #DDDDDD; 
        padding: 0 10px 0 20px;  /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
}
.oneColFixCtrHdr #header h1 {
        margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
        padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
}
.oneColFixCtrHdr #mainContent {
        padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
        background: #000000;
        background-image:url(images/bg.jpg); background-repeat:no-repeat; max-height:100%;
        position:relative;
}
.oneColFixCtrHdr #footer {
        padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
        background:#DDDDDD;
}
.oneColFixCtrHdr #footer p {
        margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
        padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
}
-->
</style></head>

<body class="oneColFixCtrHdr">

<div id="container">
  <div id="header">
    <h1>Header</h1>
  <!-- end #header --></div>
  <div id="mainContent">
    <h1>&nbsp;</h1>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    <p>&nbsp;</p>
    
        <!-- end #mainContent --></div>
  <div id="footer">
    <p>Footer</p>
  <!-- end #footer --></div>
<!-- end #container --></div>
</body>
</html>

Edited by VaiFanatic - 7/8/12 at 7:40pm
The Vortex
(16 items)
 
The Beast
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K @ 4.5ghz Asus P8P67 WS Revolution 2 x HIS IceQ HD 6970 2GB G.Skill Ripjaws X 16GB 2133MHZ 
Hard DriveOptical DriveCoolingOS
Crucial C300 SSD 128GB SATA III, WD Caviar Black ASUS DRW SATA 24X DVD Corsair H60 Windows 8 Enterprise 64-Bit 
MonitorMonitorMonitorKeyboard
Samsung SyncMaster SA550 Samsung SyncMaster SA550 Samsung SyncMaster SA550 Logitech G510 
PowerCaseMouse
Antec CP-1000 Antec Twelve Hundred ATX Full Tower Logitech G9x 
CPUMotherboardGraphicsRAM
Intel Core i7-960 Bloomfield ASUS P6X58D Sapphire Vapor-X HD5870 G.Skill Ripjaws 24GB 1600MHZ 
Hard DriveHard DriveOptical DriveOS
Intel 510 120GB SSD SATA III, WD Caviar Black 1TB Kingston SSDNow V+ Series SNVP325-S2B/64GB 2.5"... ASUS DRW SATA 24X DVD Burner Windows 7 Ultimate 64-Bit SP1 
PowerCase
Antec CP-1000 Antec Twelve Hundred ATX Full Tower 
  hide details  
Reply
The Vortex
(16 items)
 
The Beast
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K @ 4.5ghz Asus P8P67 WS Revolution 2 x HIS IceQ HD 6970 2GB G.Skill Ripjaws X 16GB 2133MHZ 
Hard DriveOptical DriveCoolingOS
Crucial C300 SSD 128GB SATA III, WD Caviar Black ASUS DRW SATA 24X DVD Corsair H60 Windows 8 Enterprise 64-Bit 
MonitorMonitorMonitorKeyboard
Samsung SyncMaster SA550 Samsung SyncMaster SA550 Samsung SyncMaster SA550 Logitech G510 
PowerCaseMouse
Antec CP-1000 Antec Twelve Hundred ATX Full Tower Logitech G9x 
CPUMotherboardGraphicsRAM
Intel Core i7-960 Bloomfield ASUS P6X58D Sapphire Vapor-X HD5870 G.Skill Ripjaws 24GB 1600MHZ 
Hard DriveHard DriveOptical DriveOS
Intel 510 120GB SSD SATA III, WD Caviar Black 1TB Kingston SSDNow V+ Series SNVP325-S2B/64GB 2.5"... ASUS DRW SATA 24X DVD Burner Windows 7 Ultimate 64-Bit SP1 
PowerCase
Antec CP-1000 Antec Twelve Hundred ATX Full Tower 
  hide details  
Reply
post #2 of 12
Hi VaiFanatic,

First off, and I don't mean this to be too picky, but make sure you include at the top of the file so that you've declared the doctype and do not have missing start tags.

Now to your problem: because you haven't defined the div as having any height and there wasn't content in that div (until you placed the blank paragraph tags). This will just collapse the div because there's nothing in there for the box to display. This is why your blank

solution worked: you gave the div content that stretched the div box. You can define the #mainContent in your CSS to have a height and that would solve your problem of the background image not showing up.

example:

Code:
<style type="text/css">
.oneColFixCtrHdr #mainContent {
        padding: 0 20px;
        background: #000000;
        background-image:url(img.jpg); background-repeat:no-repeat; max-height:100%;
        position:relative;
        height:500px;
}
</style>

Hopefully this not only solves your problem, but also helps you better understand how divs work. Happy coding!
Edited by TheDevilsWaffle - 7/11/12 at 8:26am
Blue Beastie 2.0
(16 items)
 
  
CPUMotherboardGraphicsRAM
AMD Phenom II X6 1090 T ASUS Crosshair Formula III ASUS HD5870 8x Gb Corsair Dominator DDR3 
Hard DriveHard DriveHard DriveOptical Drive
Intel X-25 SSD Western Digital Velociraptor Western Digital Velociraptor ASUS DVD/CD Optical Drive 
OSMonitorKeyboardPower
Windows 7 x64 Home Premium ASUS PG221H 22" LCD Logitech G15-Rev.2 Enermax Galaxy 850W 
CaseMouseMouse PadAudio
Cooler Master Cosmos II Logitech G500 Firefox Mousepad ASUS Xonar Essence 
  hide details  
Reply
Blue Beastie 2.0
(16 items)
 
  
CPUMotherboardGraphicsRAM
AMD Phenom II X6 1090 T ASUS Crosshair Formula III ASUS HD5870 8x Gb Corsair Dominator DDR3 
Hard DriveHard DriveHard DriveOptical Drive
Intel X-25 SSD Western Digital Velociraptor Western Digital Velociraptor ASUS DVD/CD Optical Drive 
OSMonitorKeyboardPower
Windows 7 x64 Home Premium ASUS PG221H 22" LCD Logitech G15-Rev.2 Enermax Galaxy 850W 
CaseMouseMouse PadAudio
Cooler Master Cosmos II Logitech G500 Firefox Mousepad ASUS Xonar Essence 
  hide details  
Reply
post #3 of 12
Yep,

#mainContent needs to be given dimensions. I would suggest looking into min-height instead of just height. That will allow your content div to grow as needed. Try changing font size in the browser ( as your user can do this ) and adding more content as a testing mechanism. More often than not fixed height divs usually end up causing issues down the road unless there is only image content in there.

If your background is not repeatable, try fading it to a solid color at the bottom and setting the background to that color so that it still looks good if it does end up expanding past your initial background image.
White TITAN
(16 items)
 
   
CPUMotherboardGraphicsRAM
intel core i7-3770k Asus Z77 Sabertooth EVGA Titan SC Corsair Dominator Platinum 16GB (2x8GB) 
Hard DriveHard DriveHard DriveOptical Drive
Samsung 840 Pro  WD Black Crucial M4 LG Blueray 
CoolingOSMonitorPower
Swiftech H220 Windows 7 64bit Dell 2311h Ultrasharp x 2 Corsair AX850 
CaseMouseMouse PadAudio
Fractal Design Define R4 White (w/ Window) Logitech G700 Razer Control Edition Sound Blaster ZxR 
CPUMotherboardGraphicsRAM
Intel 980x Asus Rampage iii Extreme EVGA GTX580 SLI Patriot Viper Xtreme 12GB DDR3 2000 (PC3 16000) 
Hard DriveHard DriveHard DriveOptical Drive
120GB Corsair Force Series 3 SSD WD Caviar Black 640GB Crucial M4 128GB SSD LG Black Blu-ray Drive SATA Model UH12LS28 
CoolingCoolingCoolingCooling
XSPC RX360 and RX120 Rads Watercool HeatKiller 3.0 Limited Edition Black ... XSPC Dual Bay Res with Swiftech MCP655 Pump Silver Shining Bitspower Compression Fittings 
CoolingCoolingCoolingCooling
PrimoFlex Pro LRT Black Tubing -1/2in. ID X 3/4in. 3x Gentle Typhoon 120mm Fan 1850RPM (AP-15)  1x Noiseblocker NB-BlackSilentPro PL-2 120mm Ul... Koolance VID-NX580 Full Cover GPU Waterblock x2 
OSMonitorKeyboardPower
Windows 7 Home Premium x64 Dell U2311 Ultrasharp x2 Max Keyboard Nighthawk X8 Semi-Custom - Mechani... Antec High Current Gamer 900W 
CaseMouseMouse PadAudio
Xigmatek Elysium Black Logitech G700 Razer Goliathus Creative Sound Blaster Recon3D Fatal1ty Pro 
  hide details  
Reply
White TITAN
(16 items)
 
   
CPUMotherboardGraphicsRAM
intel core i7-3770k Asus Z77 Sabertooth EVGA Titan SC Corsair Dominator Platinum 16GB (2x8GB) 
Hard DriveHard DriveHard DriveOptical Drive
Samsung 840 Pro  WD Black Crucial M4 LG Blueray 
CoolingOSMonitorPower
Swiftech H220 Windows 7 64bit Dell 2311h Ultrasharp x 2 Corsair AX850 
CaseMouseMouse PadAudio
Fractal Design Define R4 White (w/ Window) Logitech G700 Razer Control Edition Sound Blaster ZxR 
CPUMotherboardGraphicsRAM
Intel 980x Asus Rampage iii Extreme EVGA GTX580 SLI Patriot Viper Xtreme 12GB DDR3 2000 (PC3 16000) 
Hard DriveHard DriveHard DriveOptical Drive
120GB Corsair Force Series 3 SSD WD Caviar Black 640GB Crucial M4 128GB SSD LG Black Blu-ray Drive SATA Model UH12LS28 
CoolingCoolingCoolingCooling
XSPC RX360 and RX120 Rads Watercool HeatKiller 3.0 Limited Edition Black ... XSPC Dual Bay Res with Swiftech MCP655 Pump Silver Shining Bitspower Compression Fittings 
CoolingCoolingCoolingCooling
PrimoFlex Pro LRT Black Tubing -1/2in. ID X 3/4in. 3x Gentle Typhoon 120mm Fan 1850RPM (AP-15)  1x Noiseblocker NB-BlackSilentPro PL-2 120mm Ul... Koolance VID-NX580 Full Cover GPU Waterblock x2 
OSMonitorKeyboardPower
Windows 7 Home Premium x64 Dell U2311 Ultrasharp x2 Max Keyboard Nighthawk X8 Semi-Custom - Mechani... Antec High Current Gamer 900W 
CaseMouseMouse PadAudio
Xigmatek Elysium Black Logitech G700 Razer Goliathus Creative Sound Blaster Recon3D Fatal1ty Pro 
  hide details  
Reply
post #4 of 12
Thread Starter 
Quote:
Originally Posted by TheDevilsWaffle View Post

Hi VaiFanatic,
First off, and I don't mean this to be too picky, but make sure you include at the top of the file so that you've declared the doctype and do not have missing start tags.
Now to your problem: because you haven't defined the div as having any height and there wasn't content in that div (until you placed the blank

's). This will just collapse the div because there's nothing in there for the box to display. This is why your blank

solution worked: you gave the div content that stretched the div box. You can define the #mainContent in your CSS to have a height and that would solve your problem of the background image not showing up.
example:

Code:
<style type="text/css">
.oneColFixCtrHdr #mainContent {
        padding: 0 20px;
        background: #000000;
        background-image:url(img.jpg); background-repeat:no-repeat; max-height:100%;
        position:relative;
        height:500px;
}
</style>
Hopefully this not only solves your problem, but also helps you better understand how divs work. Happy coding!

Thanks! I'll give it a try and let you know how it works!
Quote:
Originally Posted by glakr View Post

Yep,
#mainContent needs to be given dimensions. I would suggest looking into min-height instead of just height. That will allow your content div to grow as needed. Try changing font size in the browser ( as your user can do this ) and adding more content as a testing mechanism. More often than not fixed height divs usually end up causing issues down the road unless there is only image content in there.
If your background is not repeatable, try fading it to a solid color at the bottom and setting the background to that color so that it still looks good if it does end up expanding past your initial background image.

It does not repeat as of right now. The way I have it set, is that the image is at it's max size, so the image itself will not grow with content if the font size changes or content gets added. That's why I intended to put all the info into a scrollable text box with slight opacity. So should the user adjust the font size, I'm assuming the text box will format it accordingly without it actually growing or shrinking in size itself.

+ Rep to the two of you!
The Vortex
(16 items)
 
The Beast
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K @ 4.5ghz Asus P8P67 WS Revolution 2 x HIS IceQ HD 6970 2GB G.Skill Ripjaws X 16GB 2133MHZ 
Hard DriveOptical DriveCoolingOS
Crucial C300 SSD 128GB SATA III, WD Caviar Black ASUS DRW SATA 24X DVD Corsair H60 Windows 8 Enterprise 64-Bit 
MonitorMonitorMonitorKeyboard
Samsung SyncMaster SA550 Samsung SyncMaster SA550 Samsung SyncMaster SA550 Logitech G510 
PowerCaseMouse
Antec CP-1000 Antec Twelve Hundred ATX Full Tower Logitech G9x 
CPUMotherboardGraphicsRAM
Intel Core i7-960 Bloomfield ASUS P6X58D Sapphire Vapor-X HD5870 G.Skill Ripjaws 24GB 1600MHZ 
Hard DriveHard DriveOptical DriveOS
Intel 510 120GB SSD SATA III, WD Caviar Black 1TB Kingston SSDNow V+ Series SNVP325-S2B/64GB 2.5"... ASUS DRW SATA 24X DVD Burner Windows 7 Ultimate 64-Bit SP1 
PowerCase
Antec CP-1000 Antec Twelve Hundred ATX Full Tower 
  hide details  
Reply
The Vortex
(16 items)
 
The Beast
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K @ 4.5ghz Asus P8P67 WS Revolution 2 x HIS IceQ HD 6970 2GB G.Skill Ripjaws X 16GB 2133MHZ 
Hard DriveOptical DriveCoolingOS
Crucial C300 SSD 128GB SATA III, WD Caviar Black ASUS DRW SATA 24X DVD Corsair H60 Windows 8 Enterprise 64-Bit 
MonitorMonitorMonitorKeyboard
Samsung SyncMaster SA550 Samsung SyncMaster SA550 Samsung SyncMaster SA550 Logitech G510 
PowerCaseMouse
Antec CP-1000 Antec Twelve Hundred ATX Full Tower Logitech G9x 
CPUMotherboardGraphicsRAM
Intel Core i7-960 Bloomfield ASUS P6X58D Sapphire Vapor-X HD5870 G.Skill Ripjaws 24GB 1600MHZ 
Hard DriveHard DriveOptical DriveOS
Intel 510 120GB SSD SATA III, WD Caviar Black 1TB Kingston SSDNow V+ Series SNVP325-S2B/64GB 2.5"... ASUS DRW SATA 24X DVD Burner Windows 7 Ultimate 64-Bit SP1 
PowerCase
Antec CP-1000 Antec Twelve Hundred ATX Full Tower 
  hide details  
Reply
post #5 of 12
Thread Starter 
Setting the max height to 600px, the max height of the background image worked perfectly!

Now, to insert a scrollable text box, so I need not worry about the container ever expanding beyond that point.

As I said before, I'm assuming any font resizing that the user may do, will all be formatted and contained within the text box without the box growing in size. The scrolling aspect will make up for size changes.

Am I correct in this assumption? Or is there something else I should know?
The Vortex
(16 items)
 
The Beast
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K @ 4.5ghz Asus P8P67 WS Revolution 2 x HIS IceQ HD 6970 2GB G.Skill Ripjaws X 16GB 2133MHZ 
Hard DriveOptical DriveCoolingOS
Crucial C300 SSD 128GB SATA III, WD Caviar Black ASUS DRW SATA 24X DVD Corsair H60 Windows 8 Enterprise 64-Bit 
MonitorMonitorMonitorKeyboard
Samsung SyncMaster SA550 Samsung SyncMaster SA550 Samsung SyncMaster SA550 Logitech G510 
PowerCaseMouse
Antec CP-1000 Antec Twelve Hundred ATX Full Tower Logitech G9x 
CPUMotherboardGraphicsRAM
Intel Core i7-960 Bloomfield ASUS P6X58D Sapphire Vapor-X HD5870 G.Skill Ripjaws 24GB 1600MHZ 
Hard DriveHard DriveOptical DriveOS
Intel 510 120GB SSD SATA III, WD Caviar Black 1TB Kingston SSDNow V+ Series SNVP325-S2B/64GB 2.5"... ASUS DRW SATA 24X DVD Burner Windows 7 Ultimate 64-Bit SP1 
PowerCase
Antec CP-1000 Antec Twelve Hundred ATX Full Tower 
  hide details  
Reply
The Vortex
(16 items)
 
The Beast
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K @ 4.5ghz Asus P8P67 WS Revolution 2 x HIS IceQ HD 6970 2GB G.Skill Ripjaws X 16GB 2133MHZ 
Hard DriveOptical DriveCoolingOS
Crucial C300 SSD 128GB SATA III, WD Caviar Black ASUS DRW SATA 24X DVD Corsair H60 Windows 8 Enterprise 64-Bit 
MonitorMonitorMonitorKeyboard
Samsung SyncMaster SA550 Samsung SyncMaster SA550 Samsung SyncMaster SA550 Logitech G510 
PowerCaseMouse
Antec CP-1000 Antec Twelve Hundred ATX Full Tower Logitech G9x 
CPUMotherboardGraphicsRAM
Intel Core i7-960 Bloomfield ASUS P6X58D Sapphire Vapor-X HD5870 G.Skill Ripjaws 24GB 1600MHZ 
Hard DriveHard DriveOptical DriveOS
Intel 510 120GB SSD SATA III, WD Caviar Black 1TB Kingston SSDNow V+ Series SNVP325-S2B/64GB 2.5"... ASUS DRW SATA 24X DVD Burner Windows 7 Ultimate 64-Bit SP1 
PowerCase
Antec CP-1000 Antec Twelve Hundred ATX Full Tower 
  hide details  
Reply
post #6 of 12
Quote:
Originally Posted by VaiFanatic View Post

Setting the max height to 600px, the max height of the background image worked perfectly!
Now, to insert a scrollable text box, so I need not worry about the container ever expanding beyond that point.
As I said before, I'm assuming any font resizing that the user may do, will all be formatted and contained within the text box without the box growing in size. The scrolling aspect will make up for size changes.
Am I correct in this assumption? Or is there something else I should know?

To delegate scroll bars, you should look into the CSS property overflow. If you're wanting it just 1 direction, tack a -x or -y on the end.

Yes, that is how it should work.
post #7 of 12
Thread Starter 
I got the scrolling feature to work just fine. Unfortunately, the text box if position at the top of the background image, blocking what basically amounts to a logo. I'd like to move it further down to the bottom of the container.

Also, I'm having issues centering the text box, as well as a photograph I put within it.

I'd post the code, but I have to download my file first from my hosting server, as I just arrived in the Czech Republic just about an hour ago.
The Vortex
(16 items)
 
The Beast
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K @ 4.5ghz Asus P8P67 WS Revolution 2 x HIS IceQ HD 6970 2GB G.Skill Ripjaws X 16GB 2133MHZ 
Hard DriveOptical DriveCoolingOS
Crucial C300 SSD 128GB SATA III, WD Caviar Black ASUS DRW SATA 24X DVD Corsair H60 Windows 8 Enterprise 64-Bit 
MonitorMonitorMonitorKeyboard
Samsung SyncMaster SA550 Samsung SyncMaster SA550 Samsung SyncMaster SA550 Logitech G510 
PowerCaseMouse
Antec CP-1000 Antec Twelve Hundred ATX Full Tower Logitech G9x 
CPUMotherboardGraphicsRAM
Intel Core i7-960 Bloomfield ASUS P6X58D Sapphire Vapor-X HD5870 G.Skill Ripjaws 24GB 1600MHZ 
Hard DriveHard DriveOptical DriveOS
Intel 510 120GB SSD SATA III, WD Caviar Black 1TB Kingston SSDNow V+ Series SNVP325-S2B/64GB 2.5"... ASUS DRW SATA 24X DVD Burner Windows 7 Ultimate 64-Bit SP1 
PowerCase
Antec CP-1000 Antec Twelve Hundred ATX Full Tower 
  hide details  
Reply
The Vortex
(16 items)
 
The Beast
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K @ 4.5ghz Asus P8P67 WS Revolution 2 x HIS IceQ HD 6970 2GB G.Skill Ripjaws X 16GB 2133MHZ 
Hard DriveOptical DriveCoolingOS
Crucial C300 SSD 128GB SATA III, WD Caviar Black ASUS DRW SATA 24X DVD Corsair H60 Windows 8 Enterprise 64-Bit 
MonitorMonitorMonitorKeyboard
Samsung SyncMaster SA550 Samsung SyncMaster SA550 Samsung SyncMaster SA550 Logitech G510 
PowerCaseMouse
Antec CP-1000 Antec Twelve Hundred ATX Full Tower Logitech G9x 
CPUMotherboardGraphicsRAM
Intel Core i7-960 Bloomfield ASUS P6X58D Sapphire Vapor-X HD5870 G.Skill Ripjaws 24GB 1600MHZ 
Hard DriveHard DriveOptical DriveOS
Intel 510 120GB SSD SATA III, WD Caviar Black 1TB Kingston SSDNow V+ Series SNVP325-S2B/64GB 2.5"... ASUS DRW SATA 24X DVD Burner Windows 7 Ultimate 64-Bit SP1 
PowerCase
Antec CP-1000 Antec Twelve Hundred ATX Full Tower 
  hide details  
Reply
post #8 of 12
Quote:
Originally Posted by VaiFanatic View Post

I got the scrolling feature to work just fine. Unfortunately, the text box if position at the top of the background image, blocking what basically amounts to a logo. I'd like to move it further down to the bottom of the container.
Also, I'm having issues centering the text box, as well as a photograph I put within it.
I'd post the code, but I have to download my file first from my hosting server, as I just arrived in the Czech Republic just about an hour ago.

The markup would be helpful.
post #9 of 12
Thread Starter 
It seems I've uploaded the wrong files. I've also been busy just about every day over here, and taking short naps when I can. So I probably won't mess with this til I get back on the 17th.
The Vortex
(16 items)
 
The Beast
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K @ 4.5ghz Asus P8P67 WS Revolution 2 x HIS IceQ HD 6970 2GB G.Skill Ripjaws X 16GB 2133MHZ 
Hard DriveOptical DriveCoolingOS
Crucial C300 SSD 128GB SATA III, WD Caviar Black ASUS DRW SATA 24X DVD Corsair H60 Windows 8 Enterprise 64-Bit 
MonitorMonitorMonitorKeyboard
Samsung SyncMaster SA550 Samsung SyncMaster SA550 Samsung SyncMaster SA550 Logitech G510 
PowerCaseMouse
Antec CP-1000 Antec Twelve Hundred ATX Full Tower Logitech G9x 
CPUMotherboardGraphicsRAM
Intel Core i7-960 Bloomfield ASUS P6X58D Sapphire Vapor-X HD5870 G.Skill Ripjaws 24GB 1600MHZ 
Hard DriveHard DriveOptical DriveOS
Intel 510 120GB SSD SATA III, WD Caviar Black 1TB Kingston SSDNow V+ Series SNVP325-S2B/64GB 2.5"... ASUS DRW SATA 24X DVD Burner Windows 7 Ultimate 64-Bit SP1 
PowerCase
Antec CP-1000 Antec Twelve Hundred ATX Full Tower 
  hide details  
Reply
The Vortex
(16 items)
 
The Beast
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K @ 4.5ghz Asus P8P67 WS Revolution 2 x HIS IceQ HD 6970 2GB G.Skill Ripjaws X 16GB 2133MHZ 
Hard DriveOptical DriveCoolingOS
Crucial C300 SSD 128GB SATA III, WD Caviar Black ASUS DRW SATA 24X DVD Corsair H60 Windows 8 Enterprise 64-Bit 
MonitorMonitorMonitorKeyboard
Samsung SyncMaster SA550 Samsung SyncMaster SA550 Samsung SyncMaster SA550 Logitech G510 
PowerCaseMouse
Antec CP-1000 Antec Twelve Hundred ATX Full Tower Logitech G9x 
CPUMotherboardGraphicsRAM
Intel Core i7-960 Bloomfield ASUS P6X58D Sapphire Vapor-X HD5870 G.Skill Ripjaws 24GB 1600MHZ 
Hard DriveHard DriveOptical DriveOS
Intel 510 120GB SSD SATA III, WD Caviar Black 1TB Kingston SSDNow V+ Series SNVP325-S2B/64GB 2.5"... ASUS DRW SATA 24X DVD Burner Windows 7 Ultimate 64-Bit SP1 
PowerCase
Antec CP-1000 Antec Twelve Hundred ATX Full Tower 
  hide details  
Reply
post #10 of 12
Thread Starter 
Well, I'm back home. Here's that code I promised:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
        font: 100% Verdana, Arial, Helvetica, sans-serif;
        background: #000000;
        margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
        padding: 0;
        text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
        color: #000000;
}
.oneColFixCtrHdr #container {
        width: 780px;  /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
        background: #FFFFFF;
        margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
        border: 1px solid #000000;
        text-align: left; /* this overrides the text-align: center on the body element. */
}
.oneColFixCtrHdr #header {
        background: #DDDDDD; 
        padding: 0 10px 0 20px;  /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
}
.oneColFixCtrHdr #header h1 {
        margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
        padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
}
.oneColFixCtrHdr #mainContent {
        padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
        background: #000000;
        background-image:url(images/bg.jpg); background-repeat:no-repeat; max-height:100%;
        position:relative;
        height:600px;
}
.oneColFixCtrHdr #footer {
        padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
        background:#DDDDDD;
}
.oneColFixCtrHdr #footer p {
        margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
        padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
}

div.transbox
  {
  width:550px;
  height:200px;
  margin:30px 50px;
  background-color:#000000;
  border:1px solid black;
  opacity:0.6;
  filter:alpha(opacity=80); /* For IE8 and earlier */
  position:absolute;
  }
div.transbox p
  {
  margin:30px 40px;
  font-weight:bold;
  font-size:12px;
  color:#FFFFFF;
  }
-->
</style></head>

<body class="oneColFixCtrHdr">

<div id="container">
  <div id="header">
    <h1>Header</h1>
  <!-- end #header --></div>
  <div id="mainContent">
    <div style="overflow:auto" class="transbox">
      <p><img src="images/savz58.jpg" /></p>
      <p></p>
      <p>The SA vz. 58 (&quot;submachine gun, model of 1958&quot;; sometimes incorrectly referred to as &quot;CZ 58&quot;) is a military-designed assault rifle that was originally manufactured in the former Czechoslovakia. The originating state-owned factory (&quot;Česká zbrojovka&quot;) still exists today and resides within the modern borders of the Czech Republic in the town of Uherský Brod. </p>
      <p>In sum, the SA vz. 58 is a 7.62x39 caliber, short-stroke, gas-operated, magazine-fed, selective-fire (fully- or semi-automatic), striker-initiated, shouldered weapon that engages from a closed bolt. Although perhaps similar externally to the highly successful, battle- and time-tested Kalashnikov AK-47 assault rifle, the SA vz. 58's internal operation is functionally and materially different. From the milled (versus typically stamped) receiver to the top-exiting extraction system, the rifle's design is believed by many to be superior to the vaunted AK-47 in several regards, not the least of which is its lighter weight and less moving parts. This, coupled with an obvious higher quality-control level in the manufacturing process, adds up to quicker employment and a demonstrated better accuracy. Among other things, the last-round, magazine hold-open characteristic (missing on the AK-47) is certainly a welcome feature.</p>
      <p>In case you were wondering, &quot;SA&quot; is abbreviation of the Czech word &quot;Samopal&quot; (meaning, more or less, &quot;submachine gun&quot;). The letters &quot;vz.&quot; are simply an abbreviation of the Czech word &quot;vzor&quot; (meaning &quot;model&quot;). One thing that certainly does not need translation, however, is that this is one kick-ass rifle. Get yours today!<br />
      </p>
    </div>
  </div>
    <p>Footer</p>
  <!-- end #footer --></div>
<!-- end #container --></div>
</body>
</html>
The Vortex
(16 items)
 
The Beast
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K @ 4.5ghz Asus P8P67 WS Revolution 2 x HIS IceQ HD 6970 2GB G.Skill Ripjaws X 16GB 2133MHZ 
Hard DriveOptical DriveCoolingOS
Crucial C300 SSD 128GB SATA III, WD Caviar Black ASUS DRW SATA 24X DVD Corsair H60 Windows 8 Enterprise 64-Bit 
MonitorMonitorMonitorKeyboard
Samsung SyncMaster SA550 Samsung SyncMaster SA550 Samsung SyncMaster SA550 Logitech G510 
PowerCaseMouse
Antec CP-1000 Antec Twelve Hundred ATX Full Tower Logitech G9x 
CPUMotherboardGraphicsRAM
Intel Core i7-960 Bloomfield ASUS P6X58D Sapphire Vapor-X HD5870 G.Skill Ripjaws 24GB 1600MHZ 
Hard DriveHard DriveOptical DriveOS
Intel 510 120GB SSD SATA III, WD Caviar Black 1TB Kingston SSDNow V+ Series SNVP325-S2B/64GB 2.5"... ASUS DRW SATA 24X DVD Burner Windows 7 Ultimate 64-Bit SP1 
PowerCase
Antec CP-1000 Antec Twelve Hundred ATX Full Tower 
  hide details  
Reply
The Vortex
(16 items)
 
The Beast
(11 items)
 
 
CPUMotherboardGraphicsRAM
i7-2600K @ 4.5ghz Asus P8P67 WS Revolution 2 x HIS IceQ HD 6970 2GB G.Skill Ripjaws X 16GB 2133MHZ 
Hard DriveOptical DriveCoolingOS
Crucial C300 SSD 128GB SATA III, WD Caviar Black ASUS DRW SATA 24X DVD Corsair H60 Windows 8 Enterprise 64-Bit 
MonitorMonitorMonitorKeyboard
Samsung SyncMaster SA550 Samsung SyncMaster SA550 Samsung SyncMaster SA550 Logitech G510 
PowerCaseMouse
Antec CP-1000 Antec Twelve Hundred ATX Full Tower Logitech G9x 
CPUMotherboardGraphicsRAM
Intel Core i7-960 Bloomfield ASUS P6X58D Sapphire Vapor-X HD5870 G.Skill Ripjaws 24GB 1600MHZ 
Hard DriveHard DriveOptical DriveOS
Intel 510 120GB SSD SATA III, WD Caviar Black 1TB Kingston SSDNow V+ Series SNVP325-S2B/64GB 2.5"... ASUS DRW SATA 24X DVD Burner Windows 7 Ultimate 64-Bit SP1 
PowerCase
Antec CP-1000 Antec Twelve Hundred ATX Full Tower 
  hide details  
Reply
New Posts  All Forums:Forum Nav:
  Return Home
  Back to Forum: Web Coding
Overclock.net › Forums › Software, Programming and Coding › Coding and Programming › Web Coding › Fixed container dimensions?