How do i set the relative path and folder paths in HTML and CSS from VS 2012?


Tags: javascript,html,css,visual-studio-2012

Problem :

i'm creating a simple HTML site with css and javascript. so there are folders named css and scripts also images for images. the Project structure is like in this image

enter image description here

The problem i have is how to set the paths for the css, images and js files from the html

i have styles.css file with the following style

html {
padding-top: 25px;  
background-image: url(images/bg_page.png); 

}

the link to styles.css file from html like this

<title>Chapter 2</title>
<link  href="css/styles.css" rel="stylesheet" />
<link href="http://fonts.googleapis.com/css?family=Gravitas+One" rel="stylesheet" />

problem: it doesn't set the styles in the css to the html. I don't know how to set the image URL path in css as well. Any one who uses VS 2012, would be able to fix this path problems?

There is this "solution1" folder that it creates, which is kind of annoying. so i wonder is there a better way to organize folders and files especially in VS 2012?

thanks



Solution :

Are you certain that you set up different folders? Just because the solution shows different folders doesn't mean that actual folders have been created. Check your source folder to make sure.

If the folders exist, try adding / before images in background-image in your css.


    CSS Howto..

    how to set background image in css at MVC4

    How to animate an “:after” using CSS or jQuery

    How to write CSS correctly when there are the same properties but with different prefixes for the various browser support?

    How to double an image size in HTML using only CSS?

    How to contain a div floating outside of container div

    how to make this gradient vertical

    How to avoid orphaned headings in CSS columns?

    How to remove the double border bottom line below the breadcrumb

    How to add two CSS Class to control in the code behind?

    How to get WebView to ignore css

    Dropdown container not showing right padding

    How to display separate paragraphs in the same area using CSS HTML

    how to align an 'a' element in html/css

    How to get a div text from html content

    DotNetNuke Skinning: How do I use\add skin.css?

    How to get border width in jQuery/javascript

    how to add a home button from css in jquery mobile?

    How to position a vertical menu as nested
      under horizontal parent

    jQuery — how to animate a div using height:auto

    How can I get IE7 to see an HTC file in the same directory as my CSS?

    How do I vertically and horizontally center all these elements?

    How to make all input boxes ordered in a straight line? [closed]

    How to resize the width of a div based on another div on it's right, only with CSS(no JS)

    How to find an element using Watir by inline css styles

    How to apply the grayscale jquery plugin to a background image?

    How to get the current year using css?

    How to style last tag img css?

    How to change opacity in disabled state of image in css

    how to give multiple colors in the same cell in a full calendar?

    How can I display just a portion of an image in HTML/CSS?