473,765 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

diffrence between max-height and height based on occupied space

64 New Member
hi
what is real diffrence between height css property and max-height css property in action ? (both of them determine height of space that occupy for that element)
for example compare two code that mentiond below , I see both of them the same

Expand|Select|Wrap|Line Numbers
  1. <CODE>
  2. <html>
  3. <head>
  4. <style type="text/css">
  5. p
  6. {
  7. max-height:50px;
  8. background-color:yellow;
  9. }
  10. </style>
  11. </head>
  12.  
  13. <body>
  14. <p>The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px.</p>
  15.  
  16. <p>The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px.</p>
  17. </body>
  18. </html>
  19. </CODE>
  20.  
  21. and 
  22. <CODE>
  23. <html>
  24. <head>
  25. <style type="text/css">
  26. p
  27. {
  28. height:50px;
  29. background-color:yellow;
  30. }
  31. </style>
  32. </head>
  33.  
  34. <body>
  35. <p>The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px.</p>
  36.  
  37. <p>The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px. The maximum height of this paragraph is set to 50px.</p>
  38. </body>
  39. </html>
  40. </CODE>

thanks alot
May 29 '11 #1
1 927
JKing
1,206 Recognized Expert Top Contributor
Height gives an element a fixed height.

Max-height gives an element with variable height a cut off point. This will allow an element to expand in height until it reaches the value given.

The examples you provided both have content that exceeds the height given and overflows the element. Rendering them both the same.

Width and max-width function the same way.
May 30 '11 #2

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

Similar topics

6
16213
by: §Þ¦w | last post by:
How can i get the table height by Javascript
27
20066
by: Aurangzeb M. Agha | last post by:
I'm running Postgres 7.1.3, and just started having a problem where my dynamic site is going down (read-only DB, with no writes happening to the DB) regularly (every other day). I have no idea whay this is happening, and my search of the FAQ's and mail list don't bring up anything. i've attached the error from the log file, at the end of this message. Here's an output of the disk usage from within the DB dir $ du -k . 1716 ...
2
4705
by: Steve Chatham | last post by:
I have a number of selections in a listbox that would be adjusted based on a user's login info. For instance, if a sales rep logs in, he'll see items A, B, C, D, and E. However, if it's a customer, he'll only see items A & B. Is there a way to specify listbox.height based on how many rows are in it, and have it "fit"? I'm coding in asp.net. Thanks,
2
3398
by: Tor Inge Rislaa | last post by:
How to change row height in a DataGrid I have DataGrid that is filled with data from a table in a DataSet. The content of the cells is text of more than one line (as a note field). What I want is to set the height of the row based on the number of lines in it. The row height of each row in the table may be different from each other. Is there a way to do this?
2
13099
by: bemodica | last post by:
Hello I have a problem with mysql. Using the tables of type INNODB, mysql it has created the archives (ibdata1) whose dimensions exceed the 3G. I have cancelled all the database but the occupied space is remained the same one. How I can make in order to compattare this space? Thanks
1
1353
by: Johanna | last post by:
I am a real php newbie, I am having to learn as I go along - no time for tutorials or books! Background to my problem: I am working on a Wordpress theme for my personal blog -http://www.vikingprincess.net The layout is a centre column and two sidebars. I just decided I want a fourth sidebar at the very right, floating at the right of the rest of the content.
1
5809
by: JesenkoS | last post by:
I have absolutely positioned, fixed size div (mainDiv) on a page, inside which a header(headerDiv) , a div containing data (dataDiv) and a footer(footerDiv) should be displayed. Scrollbars should be shown if there is too much data to fit inside containing div. The problem is that headerDiv has variable height, so dataDiv can't have fixed height defined, but should take all available height that remains in mainDiv <style> #mainDiv{...
3
1691
by: angelicdevil | last post by:
i cud get it to resize based on width and height by setting them 100%...but now when i reduce the height even then it alters the size of the site... wat i want to do it based on width of the screen the height to be calculated and even if i reduce the height of the browser it should not deform...how can i get tht?
9
6058
Samishii23
by: Samishii23 | last post by:
So I have a custom tool tip in my program. Its a Panel control that has a few Label controls. I have set my Panel to AutoSize based on content. I tried to use the AutoSize property on one of the Labels, as this one holds the largest content, but that just extends its width. I would like to have it just expand height wise. The content I have ranges from a small sentence to a full paragraph. I haven't been able to find anything in searches. So...
0
1468
by: eihabisaac | last post by:
Hi, i have a asp button that i want to set its height from C# Code: <asp:Button ID="DCs_Green" runat="server" > </asp:Button> the CSS is as following: #DCs_Green { width:70px;
0
9568
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10007
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
9957
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
9835
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
8832
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...
1
7379
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6649
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
5276
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
3924
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

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.