473,385 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to set div width when there is no content inside it

3
In firefox and ie8 the middle div is ignoring the width when there is not content.
Please help me fix it to work the same way for ie7 also

I cannot remove the width for the main 3 div's
Expand|Select|Wrap|Line Numbers
  1. **************************************************************************
  2. <head>
  3.     <title>Untitled Page</title>
  4. <link href="ie7.css" rel="stylesheet" type="text/css" />
  5. </head>
  6. <body>
  7. <div class="divfloatLeft" id="maincontentrow1">
  8.      <div class="healthrisk">
  9.           &nbsp;healthrisk
  10.      </div>
  11.      <div class="healthylifestyles">
  12.  
  13.      </div>
  14.      <div class="regioncontent">
  15.      regioncontent goes here
  16.              </div>
  17.          </div>
  18.  
  19. </body>
  20. </html>
  21.  
  22. **************************************************************************
here is the CSS for the above htm
Expand|Select|Wrap|Line Numbers
  1. .healthrisk
  2. {
  3.     width:27%;
  4.     padding-right:20px;
  5.     float:left;
  6. }
  7. .healthylifestyles
  8. {
  9.     width:40%;
  10.     padding-right:20px;
  11.     float:left;
  12.     position:inherit;
  13. }
  14. .regioncontent
  15. {
  16.     width:27%;
  17.     float:left;
  18. }
  19. .divfloatLeft
  20. {
  21.     float:left;
  22.     display:inline;
  23. }
  24. #maincontentrow1
  25. {
  26.     width:100%;
  27. }
  28.  
I can put div inside the main div's like below:
Expand|Select|Wrap|Line Numbers
  1. <div class="healthylifestyles">
  2.     <div style="margin-top:0px;"></div>
  3.      </div>
Attached Images
File Type: jpg ie7.jpg (3.0 KB, 188 views)
May 20 '10 #1
5 3074
drhowarddrfine
7,435 Expert 4TB
When you are setting the percentage, ask percentage of what? It's always the parent. So what is the parent set to?
May 20 '10 #2
padmas
3
#maincontentrow1
{
width:100%;
}

parent is set to 100%
May 20 '10 #3
drhowarddrfine
7,435 Expert 4TB
And that is 100% of what?
May 21 '10 #4
padmas
3
you asked what is parent set to ........ the parent Div is set to 100% width...

Its 100% of the browser
May 21 '10 #5
drhowarddrfine
7,435 Expert 4TB
100% of the browser? Where do you set the "browser" width?
May 21 '10 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: Jeff Thies | last post by:
I have a series of blocks that are float left that I need centered on the page. <div class="center" align="center"> <div style="width: 100 px;float: left">thumbnail 1</div> <div style="width:...
6
by: Herman Kuiper | last post by:
Hi, The HTML at the end of this message will render erroneously on IE (at least 5.0) and prperly on Mozilla (as I've been told). That does not surprise me, but I *would* like to find some...
2
by: patrick h. | last post by:
Greetings, I am encountering some issues regarding using float while desiring to set the height to 100%. This is likely due to my own misunderstanding of the way things actually function -- any...
6
by: TJ | last post by:
I've got a calendar that is based on the concept of lots of blocks that are spans with float:left. I would like to be able to have a detail section on the right side of the screen, so that when...
0
by: jonipony | last post by:
HELP: Float Left box is drifting to the right in ie! -------------------------- I need som HELP with my CSS coding! On the following web page my design falls apart at screen size 800 x 600...
0
by: vytas | last post by:
hi, I've just ran into very strange IE behaviour. I have a table with some content: <table width="200" border="1"> <tr> <td width="50%"> <div class="bord" style="float:...
4
by: erikirl | last post by:
http://www.hardwareforfree.com/ I'm trying to get the Consumer Gift Network image to be in the top right corner of the 800px area in the header. I have searched for hours and tried a lot of...
5
by: Gozil | last post by:
Hey, Is it possible to change line on a float object? For example let say I have one <b> tag, one <p> tag and one <img> tag: I want the <img> to have float right and the <b> to have float left...
15
dlite922
by: dlite922 | last post by:
I'm back again, Intro: I've got a floating div (outerDIV) with fixed width that contains an image (IMG) and a div that contains a short text (innerDIV) Problem: In FF, the innerDIV is...
13
by: limelites | last post by:
In IE7, FF, Chrome and Safari, everything looks great but in Opera the display of the additional images in my product page looks awful. This is a site that does attract foreign visitors who do use...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.