Image and style problems in User Controls

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.