473,647 Members | 3,347 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

fixed width without td ?

greetings,

I want to achieve the following effect :
Menu1 | Menu2 | Menu3 | Menu4 | Menu5 |

I played with padding, border-width and the like and it's ok for the | .

My problem is that menu1 could be longer than menu2 : Products and FAQ
for example. But all lengths will be smaller than say : 800/6 (menus)
pixels.

I tried to give a width attribute to no avail :
#menu{
position:relati ve;
display:inline;
text-align:center;
padding-left:25px;
padding-right:25px;
border-right-color:#006749;
border-right-style:solid;
border-right-width:1px;
min-width:133px;
}

My question is : is it possible to give a fixed width to a div ?

I want to avoid the use of :
table - tr -td width="auto" if possible.

Many thx for your help !
Jul 21 '05 #1
28 5723
Gabriel wrote:
greetings,

I want to achieve the following effect :
Menu1 | Menu2 | Menu3 | Menu4 | Menu5 |

I played with padding, border-width and the like and it's ok for the | .

My problem is that menu1 could be longer than menu2 : Products and FAQ
for example. But all lengths will be smaller than say : 800/6 (menus)
pixels.

I tried to give a width attribute to no avail :
#menu{
position:relati ve;
display:inline;
text-align:center;
padding-left:25px;
padding-right:25px;
border-right-color:#006749;
border-right-style:solid;
border-right-width:1px;
min-width:133px;
}

My question is : is it possible to give a fixed width to a div ?

I want to avoid the use of :
table - tr -td width="auto" if possible.

Many thx for your help !


Yes, you can set a fixed width for <div> (or any other block element),
but 'min-width' is not the right property for it. A <div> with fixed
'min-width' will still be fluid and still attempt to fill as much
horizontal space as there is available to it.
Instead, use the 'width' property, as in:
'width: some-valid-length-value;'
- Jacques
Jul 21 '05 #2
Yes, you can set a fixed width for <div> (or any other block element),
but 'min-width' is not the right property for it. A <div> with fixed
'min-width' will still be fluid and still attempt to fill as much
horizontal space as there is available to it.
Instead, use the 'width' property, as in:
'width: some-valid-length-value;'
- Jacques


thank you for your answer but if I tried min-width, it's because width
did not work, I should have said so.
<div id="global">
<div id="navBar">
<div id="menu">
<a href="#">News</a>
</div>
<div id="menu">
<a href="#">Produc s</a>
</div>
<div id="menu">
<a href="#">Store</a>
</div>
<div id="menu">
<a href="#">Prices </a>
</div>
<div id="menu">
<a href="#">FAQ</a>
</div>
<div id="menu">
<a href="#">Contac t</a>
</div>
</div>
<div id="mainSection ">
HEre lengthy text
</div>
</div>
</div> --> end of global

css:
#navBar{
width:auto;
background-color:#FFFFFF;
text-align:center;
border-bottom-style:solid;
border-bottom-color:#006749;
border-bottom-width:1px;
position:relati ve;
background-color:#FFFFFF;
height:12pt;
}

#menu{
position:relati ve;
display:inline;
text-align:center;
padding-left:25px;
padding-right:25px;
border-right-color:#006749;
border-right-style:solid;
border-right-width:1px;
min-width:133px;
}
#global{
position:relati ve;
width:800px;
left:20%;
right:20%;
height:700px;
}
#mainSection{
background-color:#ffffff;
font-family : Tahoma,Verdana, Arial, Helvetica, sans-serif;
font-size : 10pt;
font-weight : normal;
text-align:justify;
width:auto;
position : relative;
padding-left:40px;
padding-right:40px;
padding-top:50px;
height:inherit;
overflow:auto;

}
thanks again
Jul 21 '05 #3
Gabriel wrote:
Yes, you can set a fixed width for <div> (or any other block element),
but 'min-width' is not the right property for it. A <div> with fixed
'min-width' will still be fluid and still attempt to fill as much
horizontal space as there is available to it.
Instead, use the 'width' property, as in:
'width: some-valid-length-value;'
- Jacques

thank you for your answer but if I tried min-width, it's because width
did not work, I should have said so.


"Inline" Static and "Inline" Relative positioned Elements do not accept
dimension properties. In order to accept dimension properties, they must
be "Block".

--
Gus
Jul 21 '05 #4
Gabriel <ka*******@yaho o.fr> wrote:
I want to achieve the following effect :
Menu1 | Menu2 | Menu3 | Menu4 | Menu5 |


ul.menu li{display:inli ne;border-right:1px solid #000}

<ul class="menu">
<li>Menu 1</li>
<li>Menu 2</li>
<li>Menu 3</li>
<li>Menu 4</li>
<li>Menu 5</li>
</ul>

--
Spartanicus
Jul 21 '05 #5
Gus Richter wrote:
Gabriel wrote:
Yes, you can set a fixed width for <div> (or any other block
element), but 'min-width' is not the right property for it. A <div>
with fixed 'min-width' will still be fluid and still attempt to fill
as much horizontal space as there is available to it.
Instead, use the 'width' property, as in:
'width: some-valid-length-value;'
- Jacques


thank you for your answer but if I tried min-width, it's because width
did not work, I should have said so.

"Inline" Static and "Inline" Relative positioned Elements do not accept
dimension properties. In order to accept dimension properties, they must
be "Block".

ok, the problem is that I need to put them side by side and block
retruns to a new line.
so I have to create one div per menu and specify its x,y position values ?
Jul 21 '05 #6
Spartanicus wrote:
Gabriel <ka*******@yaho o.fr> wrote:

I want to achieve the following effect :
Menu1 | Menu2 | Menu3 | Menu4 | Menu5 |

ul.menu li{display:inli ne;border-right:1px solid #000}

<ul class="menu">
<li>Menu 1</li>
<li>Menu 2</li>
<li>Menu 3</li>
<li>Menu 4</li>
<li>Menu 5</li>
</ul>


Sorry I was not explicit enough.
I've put an image here : http://charlyspace.dyndns.org/expo
Jul 21 '05 #7
This works great for me, could it for you? Maybe it's too
simple-minded. And I miss the meaning of "block
retruns to a new line."

..menu-item-container {
height: 1.8em;
text-align: center;
font-size: 75%;
font-weight: bold;
}
<p class="menu-item-container">
<a href="/index.html">Hom e</a>
| <a href="sportsboo ks.html">Sports books</a>
| <a href="video.htm l">Video</a>
| <a href="news.html ">News</a>
| <a href="glossary. html">Glossary</a>
| <a href="links.htm l">Links</a>
</p>

Only thing is, I like Sp's "border-right*:1px solid #000" a /lot/
better than ASCII vert bar. --fredo

Jul 21 '05 #8
Gabriel <ka*******@yaho o.fr> wrote:
I want to achieve the following effect :
Menu1 | Menu2 | Menu3 | Menu4 | Menu5 |


ul.menu li{display:inli ne;border-right:1px solid #000}

<ul class="menu">
<li>Menu 1</li>
<li>Menu 2</li>
<li>Menu 3</li>
<li>Menu 4</li>
<li>Menu 5</li>
</ul>


Sorry I was not explicit enough.
I've put an image here : http://charlyspace.dyndns.org/expo


Not a good design, it doesn't adapt well to varying viewport widths. To
create it and get it to work in IE you'd need to use a HTML table.

--
Spartanicus
Jul 21 '05 #9
Spartanicus wrote:
Gabriel <ka*******@yaho o.fr> wrote:

I want to achieve the following effect :
Menu1 | Menu2 | Menu3 | Menu4 | Menu5 |

ul.menu li{display:inli ne;border-right:1px solid #000}

<ul class="menu">
<li>Menu 1</li>
<li>Menu 2</li>
<li>Menu 3</li>
<li>Menu 4</li>
<li>Menu 5</li>
</ul>


Sorry I was not explicit enough.
I've put an image here : http://charlyspace.dyndns.org/expo

Not a good design, it doesn't adapt well to varying viewport widths. To
create it and get it to work in IE you'd need to use a HTML table.

The point is, in fact that the menu is contained in a block which is
always 800px wide, there is an image on top of it : the usual thing :
picture, navbar, content.

So you think that this cannot be done with pure css and that I have to
use html tables instead ?
Jul 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

179
44347
by: SoloCDM | last post by:
How do I keep my entire web page at a fixed width? ********************************************************************* Signed, SoloCDM
25
36347
by: Michael Schuerig | last post by:
I'm trying to do something seemingly very simple, but it's brought me close to crushing my head on the keyboard. All I want is a table where the head row is fixed and the body columns below are scrollable (with the ordinary scrollbars, no less). Whatever I try, the columns in the head and the body aren't aligned; the widths are computed independently which gives a completely ragged look. Michael --
5
11557
by: Johnny Meredith | last post by:
I have seven huge fixed width text file that I need to import to Access. They contain headers, subtotals, etc. that are not needed. There is also some corrupt data that we know about and can correct once the data is in Access (or during the import process itself). Furthermore, the text files are poorly set up, such that some records may be "shifted" over a few characters, and therefore the fixed width nature of the file is corrupted. ...
2
2501
by: Oliver | last post by:
Hi all. Using Access 2000. Trying to import fixed width file that has column headings that I want to becom field names - it's not an option :( Is there a way to achieve this? Thanks Oliver
1
2089
by: ChitownE | last post by:
Here's what I'm looking to do: fixed left column and a right column that fills the remainder of the space. I need the ability to position other elements relative to the borders of the right column. Without nesting containers, here's the best cross-browser version I could come up with: http://www.singley.org/test/two_cols2.html I see what's wrong - the right column is getting offset by the left column which pushes the viewport out...
8
4795
by: knoxautoguy | last post by:
This problem has consumed a lot of my time, and I'm aftraid someone will tell me that my whole approach to this objective is wrong; however, I would like to know if there is a way to do this. I have a web page divided into two major segments, with the top segment fixed and the bottom segment allowed to scroll, thus giving the look of frames without frames. I also have anchors so that users can click on a letter of the alphabet to jump...
0
1475
by: Garmt de Vries-Uiterweerd | last post by:
X-posted to opera.page-authoring, because this is a bit Opera-specific for the moment. F'up to ciwas. I am playing around with dedicated styling for the projection media type.. Currently the only browser to support it is Opera, which uses projection when in full-screen mode. On a website I maintain (http://www.jules-verne.nl/), I have set up some special styles for projection. Not that this specific website really needs it, but...
2
12931
by: dfdavis.mtu | last post by:
I have a table that I dynamically fill with data from a database for medical companies to be able to determine if their patients meet certain criteria. However they want a fixed header for it so they can keep track of the criteria as they scroll since there can be upwards of 1000 or more patients in the table. The way I got this to work was to enter the information in a table via C# by storing it in a label. This works fine and scrolls...
1
3167
by: kendrick82 | last post by:
Hi, I would like to seek some advise and assistance regarding the following matter as I am new to VB.Net. I'll appreciate any helps render. I am developing a VB application using VB.Net 2003 to extract data from text files and import it into datatable. The format of the text file is fixed length/width. Eg. http://img174.imageshack.us/img174/8457/untitledpp4.jpg I am having trouble to do so as I am not sure how to start. I had done...
0
8210
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8371
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
8516
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
7209
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
4095
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...
0
4209
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2633
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
1
1818
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1516
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.