Home > Web Front-end > JS Tutorial > How to add double solid lines in javascript

How to add double solid lines in javascript

醉折花枝作酒筹
Release: 2021-06-10 12:02:33
Original
2471 people have browsed it

In JavaScript, you can use the "css()" method to add double solid lines, and the syntax format is "$("element name").css("border","width color double")". The "css()" method sets or returns one or more style properties of the selected element.

How to add double solid lines in javascript

The operating environment of this tutorial: windows7 system, javascript version 1.8.5, Dell G3 computer.

Generally $(selector).css("border","width color line type");

css() method sets or returns one or more styles of the selected element Attributes.

Set CSS properties

To set the specified CSS properties, please use the following syntax:

css("propertyname","value");
Copy after login

Example:

<!DOCTYPE html>
<html>
<head>
<script src="/jquery/jquery-1.11.1.min.js"></script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    $("p").css("background-color","yellow");
  });
});
</script>
</head>

<body>
<h2>这是标题</h2>
<p style="background-color:#ff0000">这是一个段落。</p>
<p style="background-color:#00ff00">这是一个段落。</p>
<p style="background-color:#0000ff">这是一个段落。</p>
<p>这是一个段落。</p>
<button>设置 p 元素的背景色</button>
</body>
</html>
Copy after login

Effect:

How to add double solid lines in javascript

Line types: none (borderless line), dotted (dashed line composed of dots), dashed (dashed line composed of short lines), solid (solid line), double (double line, The width of the double line plus the width of the blank part between them is equal to the width defined by border-width), groove (3D groove-shaped border), ridge (3D ridge-shaped border), inset (3D inline border, color darker), outline (3D inline border, lighter color)

Extended information:

Return CSS properties

If you need to return the specified For the value of CSS properties, please use the following syntax:

css("propertyname");
Copy after login

Example:

<!DOCTYPE html>
<html>
<head>
<script src="/jquery/jquery-1.11.1.min.js"></script>
<script>
$(document).ready(function(){
  $("button").click(function(){
    alert("Background color = " + $("p").css("background-color"));
  });
});
</script>
</head>

<body>
<h2>这是标题</h2>
<p style="background-color:#ff0000">这是一个段落。</p>
<p style="background-color:#00ff00">这是一个段落。</p>
<p style="background-color:#0000ff">这是一个段落。</p>
<button>返回 p 元素的背景色</button>
</body>
</html>
Copy after login

Effect:

How to add double solid lines in javascript

[Recommended learning: JavaScript advanced tutorial

The above is the detailed content of How to add double solid lines in javascript. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template