Click here to Skip to main content
15,887,485 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I want to make a fixed toolbar at the top of html page, the problem is that when I re-size the browser's window size, a cutoff appears in the toolbar's content. I want to make the contents inside this toolbar not clipping. Could you please tell me what to do ?

and thanx in advance :)

this is a simple code:

<div class="toolbar">
<div class="toolbar-content">
<div class="user-photo">
user-photo
</div>
<div class="user-name">
user-name
</div>
<div class="user-setting">
user-setting
</div>
</div>
</div>

and this is CSS :

div.toolbar{
position: fixed ;
top: 0;
left: 0;
background-color: #061b34;
z-index: 1;
height: 46px;
width: 100%
}

div.toolbar-content{
position: relative;
height: 46px;
width: 745px;
top: 1px;
margin-left: auto;
margin-right: auto;
}
Posted

1 solution

Fixed layout is generally a pretty bad idea. But if you really want it fixed, be prepared to face clipping. What can you do? Temporarily makes it not fixed, move, etc. But why? It would make it not quite fixed, so why torturing yourself with fixed layout at all then?

Perhaps you should rather review your design. In particular, you can move to the opposite direction and embrace liqiud, fluid, elastic design, as referenced my past answer: Webpage screen resolution (Cross Browser\Cross Platform) problem[^].

This is just a suggestion. You can think of something else, but in all cases, I would advice to review your design.

—SA
 
Share this answer
 
v2
Comments
ALNAJJARALI 16-Dec-13 22:31pm    
Actually I would like to make this toolbar fixed like the one used by Facebook, if you have any suggestions plz tell me how to do it the same.
Sergey Alexandrovich Kryukov 16-Dec-13 22:38pm    
My suggestion remains the same. What, facebook does not show clipping? If so, it is not fixed.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900