(Visual Studio 2013을 사용 중입니다) 내 웹 페이지의 배경을 설정하고 싶습니다. 내 영문 이내에CSS를 사용하여 배경 이미지 설정에 문제가 있습니다
CSS를
body {
background-image: url("Content/Images/back.png");
}
를 넣으면 작동됩니다 파일을 내 원하는 배경을 설정합니다. 내가 CSS 파일에 넣어 그러나 CSS는
body {
background-image: url("Content/Images/back.png");
}
가 나는 영문의 속성을 가지고 있음을 언급 할 모양을
을이됩니다 작동하지 않습니다 난에 CSS의 배경 색상을 변경할 때 그것이 작동하는지 테스트하십시오. 그러나 배경을 위해 그것은 일하지 않을 것이다!!
여기 내 .aspx 파일입니다.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="EmptyWebForm.Default" %>
<link href="Content/Styles/styles.css" rel="stylesheet" type="text/css" />
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<style type="text/css">
/*body {
background-image: url("Content/Images/back.png");
}*/
</style>
</div>
</form>
</body>
</html>
는 어디에'. css' 파일을 프로젝트에 저장 하시겠습니까? 파일과 같은 디렉토리에'Content'가 있습니까? 'url()'경로는 스타일 시트의 경로를 기준으로합니다. –
.css는 Content \ Styles \ styles.css에 있습니다! 그것은 .aspx 파일의 본문에있을 때 완벽하게 잘 작동하므로 문제가 경로와 관련되어 있지 않습니다. – Usties
페이지 본문에있을 때 경로는 페이지에 상대적입니다. '.css' 파일로 이동 했으므로 그에 따라 경로를 조정해야합니다. 'url ("../ Images/back.png")'을 시도해보십시오. –