0
CSS loading problem.
the css file is not loading its content on web page. when i use to see the file in veiw-source it load a blank page. but when a reload that blank page again it loads its content and show all the content.
3 Answers
0
Could you post your html code (from the <head> tag in here please or codepen etc and i can take a look :)
But make sure that you load the style correctly
Example 1:
<link rel="stylesheet" type="text/css" href="mystyle.css">
It loads it from the same location (folder) as where your file is.
Example 2:
<link rel="stylesheet" type="text/css" href="css/mystyle.css">
The CSS folder is in the same folder as your documents, it tells the browser to lookin CSS for the file mystyle.css
Example 3:
<link rel="stylesheet" type="text/css" href="../css/mystyle.css">
It tells the browser to go one folder "up / back" and then enter CSS/mystyle.css
So if you have a folder structure like this
Root
-website
--index.html
-css
-mystyle.css
0
i am using codeigniter and my <link rel="stylesheet" type="text/css" href="<?php echo base_url().'css/mystyle.css' ?>">
0
Hey Devish
In order to use base_url(), you must first have the URL Helper loaded. This can be done either in application/config/autoload.php (on or around line 67):
$autoload['helper'] = array('url');
Or, manually:
$this->load->helper('url');
Once it's loaded, be sure to keep in mind that base_url() doesn't implicitly print or echo out anything, rather it returns the value to be printed:
echo base_url();
Remember also that the value returned is the site's base url as provided in the config file. CodeIgniter will accomodate an empty value in the config file as well:
If this (base_url) is not set then CodeIgniter will guess the protocol, domain and path to your installation.
application/config/config.php, line 13