For example, the user control at the beginning and end. At this time, the image and CSS style in the control will be faulty. When files in different locations reference user controls in the same location, the image and CSS style paths of user controls are disordered.
1. if the user control has a server control that needs to reference the image address, such as imagebutton, you only need to write the link address of the referenced image according to the position of the user control, that is, the server control can intelligently parse its exact location.
2. If an image is inserted, the link address of the image is written according to the folder where the user control is located. For example, the image file is/images/dian.gif. /Index. aspx and/member/user. aspx references/controls/head. ascx. you can insert an image . The/member/user. ASPX page displays images, but the/index. ASPX page has errors.
Correct syntax:
CopyCodeThe Code is as follows:
3. If there is a style in the control, you need to reference the image file, write the style to the CSS file, and then reference it.
With CSS, the image is relative to the CSS file, which is the best.
. Bgborder {Background: URL ('../imges/dian.jpg ')}
You can also write it into the control, but it is troublesome to implement it. You need to write the Function Positioning by yourself, so you don't have to worry about it.