Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How jquery modifies min-height Styles

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

Today Xiaobian to share with you how to modify the min-height style of jquery related knowledge points, detailed content, clear logic, I believe most people still know too much about this knowledge, so share this article for everyone to refer to, I hope you read this article after some harvest, let's learn about it together.

Modification method: 1. Use css() to set new style, syntax "$(element).css("min-height"," new value ")";2. Use attr() to add new style by setting style attribute, syntax "$(element).attr("style","min-height: new value ")".

This tutorial operates on Windows 7, jquery version 1.10.2, Dell G3 computers.

The min-height attribute is used to set the minimum height of the element. This property does not include padding, borders, or margins!

So how do you modify min-height styles using jquery?

In jquery, support a variety of ways to modify the min-height style, the following to introduce you.

Method 1: Use the CSS() method

The css() method returns or sets one or more style properties of the matching element.

Use the css() method to add a new value directly to the min-height attribute and set a new style.

Examples:

$(document).ready(function() { $("button").click(function() { $("p").css("min-height","100px"); }); }); p{ min-height:50px; border: 1px solid green; }

This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.

Modify min-height style

Method 2: Use attr() method

The attr() method sets or returns the attribute value of the selected element.

You can use this method to set the style attribute and add a new inline style to overwrite the old style.

Examples:

$(document).ready(function() { $("button").click(function() { $("p").attr("style","min-height:100px"); }); }); p{ min-height:50px; border: 1px solid green; }

This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.

Modify min-height style

The above is "jquery how to modify min-height style" all the content of this article, thank you for reading! I believe everyone has a great harvest after reading this article. Xiaobian will update different knowledge for everyone every day. If you want to learn more knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report