CSS and Images on Master Page

CSS and images on Master Page

best to use:

<link href="<%=ResolveUrl("~/css/style.css") %>" rel="stylesheet" type="text/css />

since this will cope with iis application roots unlike:

<link href="/css/style.css" rel="stylesheet" type="text/css />

How to add Background Image in css using master page

Like Kartikeya and Neophyte said in the comments, this case might just be about the incorrect path you've set your background image to be searched for.

Try the

background-image: url(../images/image.jpg);

or place your image to the same folder where your html file is located, then try it. This way you can at least figure out if it's the path that's wrong here.

Images not loaded from master page in directory

@Brendan Hannemann show me a link that where is expaint. The code i must use is:

<img src="<%=ResolveUrl("~/afbeeldingen/berichten.png") %>" alt="nieuwe berichten" id="berichten" />

Setting background image in asp.net (Master page)

This largely depends on where your css file is located. If it is located in the same folder where the 'image' folder is located, then this looks correct. However, if you css file is in a different directory (say /css) then your link in your css file will not work. Instead, either change the css link to point to a complete link:

background-image: url('http://mysite.com/images/background.jpg)

I am unsure if the '~' link will work in a stylesheet. Since your css is in the scripts folder, you should be able to do this:

background-image: url('../images/background.jpg')

img size in master page changing img size in default page

The img css caused the error due to img css changes any img in the project and in order to settle that the code of img in css must specify the container exactly.

Old code:

img {
border-style: none;
border-color: inherit;
border-width: 0;
height: 70px;
width: 200px;

New code :

.container1 .img {
border-style: none;
border-color: inherit;
border-width: 0;
width: 540px;
height:400px;

}

ASP.NET CSS file in master page

<link href="~/default.css" rel="stylesheet" type="text/css" />


Related Topics



Leave a reply



Submit