Jump to content

Apply CSS only to index.html

Every page you want the CSS to apply to, needs to have the CSS tag and be linked the the CSS file inside that, so if you only put it on the index page, it'll only apply the CSS to that page. 

PC - CPU Ryzen 5 1600 - GPU Power Color Radeon 5700XT- Motherboard Gigabyte GA-AB350 Gaming - RAM 16GB Corsair Vengeance RGB - Storage 525GB Crucial MX300 SSD + 120GB Kingston SSD   PSU Corsair CX750M - Cooling Stock - Case White NZXT S340

 

Peripherals - Mouse Logitech G502 Wireless - Keyboard Logitech G915 TKL  Headset Razer Kraken Pro V2's - Displays 2x Acer 24" GF246(1080p, 75hz, Freesync) Steering Wheel & Pedals Logitech G29 & Shifter

 

         

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, iRileyx said:

Every page you want the CSS to apply to, needs to have the CSS tag and be linked the the CSS file inside that, so if you only put it on the index page, it'll only apply the CSS to that page. 

i have a css file, styles.css. I want to apply it to all 3 pages, but on index.html i want the img tag to have different properties than on the other two sites.

Link to comment
Share on other sites

Link to post
Share on other sites

Create another css file, add a link to it in index.html and use !important in that file to override the other styles already applied.

Link to comment
Share on other sites

Link to post
Share on other sites

9 minutes ago, MrJeeves said:

Create another css file, add a link to it in index.html and use !important in that file to override the other styles already applied.

is there no way to do it without adding another css file? I want to do it without adding css files or adding any classes or anything

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, xXImm0rtaLXx said:

is there no way to do it without adding another css file? I want to do it without adding css files or adding any classes or anything

Not unless you just stick the CSS you want in two style tags.

<style>
	img {
    	    margin: 16px;
        }
</style>

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×