473,663 Members | 2,903 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

3 New Member
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, 189 views)
May 20 '10 #1
5 3082
drhowarddrfine
7,435 Recognized Expert Expert
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 New Member
#maincontentrow 1
{
width:100%;
}

parent is set to 100%
May 20 '10 #3
drhowarddrfine
7,435 Recognized Expert Expert
And that is 100% of what?
May 21 '10 #4
padmas
3 New Member
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 Recognized Expert Expert
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
15031
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: 100 px;float: left">thumbnail 2</div> <div style="width: 100 px;float: left">thumbnail 3</div> </div>
6
3688
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 workaround to get it to display properly... The thing is: on IE5 (Windows) the second "hello" is just not rendered (ok, at least I try to select all text with Ctrl-A...) when the empty <style> element is in the document. If I remove that element, it...
2
22994
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 guidance would be appreciated. To summarize, I would like to have a variable-width, 100% height, left-floating column. However, it seems as though with Mozilla/Netscape that height: 100% is not interpreted as I would
6
2805
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 the user selects an item on the calendar, the detail can get displayed on the right side there. What I have below appears to look perfect in mozilla based browsers - the detail is aligned at the top right corner of the calendar, but in IE the...
0
2045
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 (looks fine at larger screen sizes) when the left menu box that should float left is drifting to the right in Internet Explorer 6.0 (it doesn't drift to the right in Netscape 7.1).
0
1176
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: left">asdasdsdasdasdasd1</div> <div class="bord" style="float: left">asdasd</div> </td>
4
3750
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 different things but it's still not working for me. I'm not very experienced so I'm sure it's something simple that I'm missing. Please look at the code below and tell me what I need to change. ==============HEADER.TPL=================== <div...
5
3360
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 then I want the <p> to have float none so it will go around the image. However if I have float left on the <b> tag the <p> will stay on the same line as <b> and the only way I know how to move it down is by giving the <b> tag a width on 100% see...
15
16595
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 displaying under the IMG because outerDIV is not wide enough to contain both of them (in some instances). In the instances where the outerDIV is wide, I don't have this problem. IE wraps the text but still keeps it to the right of the IMG. FF doesn't...
13
7932
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 Opera, so it does matter. Opera Version 9.64 Platform Vista Zen Cart 1.3.8a Site URL is www.limelites.co.uk
0
8858
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8771
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8548
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8634
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7371
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5657
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4182
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2763
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.