Get the App
SLTechnology News&Howtos  ›  Development  › 

How to introduce css into aspx

Shulou Source: shulou.com Published: 2022-06-01 12:16:32 09月12日 Update

Xiaobian to share with you how to introduce css in aspx, I believe most people still do not know how, so share this article for everyone's reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!

1, can be written directly in the control that needs style control

For example: is the div border color, thickness of 1 pixel, solid line of sight.

For example:

2. Write on this page

It can be the name assigned to multiple controls, or the class or cssclass call of the control. The difference between client-side control and server-side call is as follows:

Write style attributes in the middle: for example, a page has several controls named textinfo that can be written as

#textinfo{border:#ff61001pxsolid;}

It can also be written as.textcss, but the required space each has to be in class="textcss" to be valid. This is written in the label.

3, static addition of CSS, is to directly reference CSS:

1) First add the following to the head tag on the aspx page:

This means applying styles from the pagecss.css file in the sibling directory.

2) Use CSS to define the style of a button in an aspx file:

3) Define Pagecss.css file under peer directory:

p{font-size:9pt}

a:hover{font-size:9pt;color:#FF0000;text-decoration:none}

a:link{font-size:9pt;color:#0000FF;text-decoration:none}

a:visited{font-size:9pt;color:#990099;text-decoration:none}

.button{font-size:9pt;background:lightgreen;border-color:black;border-width:1pt;height:20}

4. Dynamic transformation:

In ASP.NET, sometimes you have to change CSS dynamically, such as sometimes making personalized pages, you can do this.

1) You still need to add a tag declaration to the head tag:

2)After that, in the page where you want to change CSS, use the following js code

voidfuction

{

MyStyleSheet.Attributes.Add("href","/css/flostyle.css")

}

3)Pages can dynamically control which css files to reference.

The above is "how to introduce css in aspx" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

Tags: Controls pages files styles dynamic tags articles content siblings that is time directories transformations controls effective less personality code pixels multiple Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info vpn macOS Apple Linux