HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 16th, 2009, 07:19 PM
MEdelman MEdelman is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2009
Posts: 42 MEdelman User rank is Corporal (100 - 500 Reputation Level)MEdelman User rank is Corporal (100 - 500 Reputation Level)MEdelman User rank is Corporal (100 - 500 Reputation Level)MEdelman User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 15 h 58 m 33 sec
Reputation Power: 2
CSS - DIV Positioning Problem

I have a page (sample code included below) that I would like to set up something like
Code:
      IMG
B1 B2 Title B3
IMG is a centered mage which is what I want. The next line is left adjusted and I want it to always be centered. The other complication is that the boxes B1, B2, and B3 can be hidden. So when any one or all of B1, B2, B3 are hidden I still want the Title to be centered. Is this possile??

I have been trying to get this working for most of the day; any help would be greatly appreciated.

There are a lot of things going on with this page so please bear with me. If you copy the code into a file it should work in your browser just fine (I have tested it with IE7 and Firefox):
Code:
<HTML>
<HEAD>
<TITLE></TITLE>
<META NAME="GENERATOR" Content="Microsoft Visual Studio">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=UTF-8">
<style>
body			{ font-family: Arial; text-align: left; font-size: small; }

.big_red		{ text-align: left; font-size: 12pt; font-weight: bold; font-family: Arial; color: red; }
.box_title_red		{ text-align: center; font-size: 12pt; font-weight: bold; color: red; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: red; }
.box_title_black	{ text-align: center; font-size: 12pt; font-weight: bold; font-family: Arial; color: black; border-bottom-style: solid; border-bottom-width: 2px; border-bottom-color: black; }
.strong			{ text-align: left; font-size: 12pt; font-weight: bold; }
.subtitle		{ text-decoration: underline; margin-top: 10; font-weight: bold; font-style: italic; font-size: 16pt; }
.title			{ text-decoration: underline; margin-top: 10; font-weight: bold; font-style: italic; font-size: 20pt; }

.cont_data_source	{ position: relative; float: left; border: 2px solid black; padding: 10px; text-align: left; width: 150px; }
.cont_data_type		{ position: relative; float: left; left: 10px; border: 2px solid red; padding: 10px; text-align: left; width: 170px; }
.cont_img_box		{ position: relative; border: none; width: 100%; }
.cont_title_box		{ position: relative; float: left; left: 20px; margin-bottom: 20pt; }
.cont_title_img		{ align: center; margin-bottom: 12pt; }
.cont_warn		{ position: relative; float: left; left: 30px; border: 2px solid red; padding: 10px; text-align: center; width: 130px; }
</style>
<script language="javascript">
function setRadio() {

	if (!document.botForm.r1.checked && !document.botForm.r2.checked) document.botForm.r2.checked = true;
	if (!document.botForm.r7.checked && !document.botForm.r8.checked) document.botForm.r8.checked = true;
	getStyle(".cont_data_type", "block");
	getStyle(".cont_data_source", "block");
	getStyle(".cont_warn", "block");
}

function getStyle (ruleName, newDisplay) {

	var i;
	var j;
	var m;
	var ss;
	
	for (i=0; i<document.styleSheets.length; i++) {
		ss = document.styleSheets[i];
		j = 0;
		m = false;
		
		do {
			if (ss.cssRules)
				m = ss.cssRules[j];
			else
				m = ss.rules[j];
			if (m)
				if (m.selectorText==ruleName)
					m.style.display = newDisplay;
			j++;
		} while (m);
	}
}
</script>
</HEAD>
<body onload="setRadio();">
  <form name="topForm" method="post">
    <div style="align: center; text-align: center; position: relative">
      <div class="cont_img_box">
        <img src="images/myimage.jpg" class="cont_title_img">
      </div>
      <div class="cont_data_source">
        <div class="box_title_black">Select DB</div>
        <span class="strong">
          <input type="radio" name="dataSource" value="xrfPS" ID=r3 checked>Primary Site<br>
          <input type="radio" name="dataSource" value="xrfBS" ID=r4>Backup Site
        </span>
      </div>
      <div class="cont_data_type">
        <div class="box_title_red">Select Data</div>
        <span class="big_red">
          <input type="radio" name="dataType" value="xrfCD" onclick="getStyle('.cont_warn', 'none');" id=r5>Current Data<br>
          <input type="radio" name="dataType" value="xrfOD" onclick="getStyle('.cont_warn', 'block');" id=r6 checked>Obsolete Data
        </span>
      </div>
      <div class="cont_title_box">
        <div class="title">Search for Matching Records</div>
        <div class="subtitle">(by record title)</div>
      </div>
      <div class="cont_warn">
        <div class="box_title_red">Warning</div>
        <span class="big_red">This Data<br>Is Obsolete!</span>
      </div>
    </div>
  </div>
  <div style="clear: both;">
	<hr>
    <h4>Data Controls Go Here</h4>    
    <hr>
    <h4>Data Table Goes Here</h4>
    <hr>
  </div>    
</form>
<form name="botForm">
  <b>Select Data: </b>
  <input type="radio" onclick="getStyle('.cont_warn', 'none'); getStyle('.cont_data_type', 'none');" value="false" name="a" id="r1">Hide
  <input type="radio" onclick="document.topForm.r5.checked=true;getStyle('.cont_d  ata_type', 'block');" value="true"  name="a" id="r2">Show
  <p><b>Select DB: </b>
  <input type="radio" onclick="getStyle('.cont_data_source', 'none');" value="false" name="a" id=r7>Hide
  <input type="radio" onclick="getStyle('.cont_data_source', 'block');" value="true"  name="a" id=r8>Show
</form>  
<p align="left"><font size="1"><b>[$Id: bytitle.asp 1.3 2009-09-16 14:01:51-07 medelman Exp medelman $]</b></font></p>
</body>
</html>
</HTML>

Reply With Quote
  #2  
Old October 19th, 2009, 06:22 PM
markoc's Avatar
markoc markoc is offline
Contributing User
ASP Free Regular (2000 - 2499 posts)
 
Join Date: Nov 2003
Location: UK
Posts: 2,255 markoc User rank is Captain (20000 - 30000 Reputation Level)markoc User rank is Captain (20000 - 30000 Reputation Level)markoc User rank is Captain (20000 - 30000 Reputation Level)markoc User rank is Captain (20000 - 30000 Reputation Level)markoc User rank is Captain (20000 - 30000 Reputation Level)markoc User rank is Captain (20000 - 30000 Reputation Level)markoc User rank is Captain (20000 - 30000 Reputation Level)markoc User rank is Captain (20000 - 30000 Reputation Level)markoc User rank is Captain (20000 - 30000 Reputation Level) 
Time spent in forums: 3 Weeks 1 Day 23 h 7 m 29 sec
Reputation Power: 306
DIV Positioning Problem

rather than hidding B1, B2, B3 why don't you create a transparent gif (blank.gif) and change the src of them to the blank.gif
__________________
Hope this advise helps.

If so please show your appreciation by adding reputation points (click gauge image on top right of this post and score).

Reply With Quote
  #3  
Old October 20th, 2009, 05:27 AM
ChiefWigs1982's Avatar
ChiefWigs1982 ChiefWigs1982 is offline
Cunning Linguist
ASP Free Expert (3500 - 3999 posts)
 
Join Date: Mar 2005
Location: I used to live at home, now I stay at the house
Posts: 3,514 ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)ChiefWigs1982 User rank is Major (30000 - 40000 Reputation Level)  Folding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner FolderFolding Points: 50746 Folding Title: Beginner Folder
Time spent in forums: 1 Month 1 Week 4 Days 7 h 4 m 57 sec
Reputation Power: 396
Try changing the code so that it sets the "visible" property instead
of the "display" one. You set it to "hidden" or "visible" accordingly.

That way, the images will take up the same space on the page
whether you can see them or not.
Comments on this post
MEdelman agrees: Thanks for helping me solve my problem -- particularly when I was dealing with trees rather than the
forest...
__________________
Support requests via PM will be ignored!
Route of Queue | The General FAQ Thread | HOW TO POST A QUESTION

Perfectly Impossible - is the eagerly awaited debut release from Jayne Sarah - please buy it - it's really good!


Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > CSS - DIV Positioning Problem


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek