funguy
funguy

Reputation: 2160

How to add additional css to wordpress theme?

I checked my blog on tablets and netbooks and it looked a bit bad, so I made an extra css and added to header.php in between :

<head>
<link media="all and (min-width: 481px) and (max-width: 768px)" type="text/css" rel="stylesheet" href="tablet.css">
</head>

But nothing happens. How to add an extra .css to make this work ?

Also tried to add this function to themes functions.php, but blog crashes.

wp_enqueue_style('my-custom-style', 'get_bloginfo('template_url') . '/css/tablet.css',false,'1.1','all and (min-width: 481px) and (max-width: 768px)');

What should I add in 'template_url' and what is the simpliest way of achieving my goal?

Thanks!

Upvotes: 1

Views: 16309

Answers (2)

Sparkup
Sparkup

Reputation: 3754

Try this :

<link rel="stylesheet" type="text/css" href="path/to/your/css/file.css">

Add it to you template header.php file, after <?php wp_head(); ?> and after your last stylesheet.

If this fails add it just before the </head> tag.

Also make sur your the path to your stylesheet is correct, if your not sure use the full path:

<link rel="stylesheet" type="text/css" href="http://www.site.com/path/file.css">

Hope it helps

Upvotes: 6

ayyp
ayyp

Reputation: 6598

You just add the code below into the bottom of your stylesheet and apply the styles that you want for those specifications in there. That's for an exact size though.

@media all and (max-width: 768px) and (min-width: 481px) {
  Your styles go in here
}

The code below this will target a max-width of 768px or a min-width of 481px.

@media all and (max-width: 768px), (min-width: 481px) {
  Your styles go in here
}

Upvotes: 2

Related Questions