开发者

How to add additional css to wordpress theme?

开发者 https://www.devze.com 2023-03-24 11:35 出处:网络
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 :

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!


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


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
}
0

精彩评论

暂无评论...
验证码 换一张
取 消