How do I add a class in html2pdf?
I have tested
$stylesheet = file_get_contents('../printpdf.css');
but this does not work.
Please try with add css with type="text/css" to your html
<link rel="stylesheet" type="text/css" href="style.css">
Related
CSS is working when i write route
Route::get('/showproduct', [ShowController::class,'index'])->name('showproduct');
Also Controller: ShowController
public function index()
{
//
return view('home.showproduct');
}
But in that way
Route
Route::get('/showproduct/{id}', [ShowController::class,'index'])->name('showproduct');
And Controller: ShowController
public function index($id)
{
//
return view('home.showproduct',['id'=>$id]);
}
Just html is comes, css and javascript not installing.
View folder name also showproduct.blade.php in home folder.
It seems you include css and js is reference to relative/current directory like below:
<link rel="stylesheet" type="text/css" href="style.css">
<script src="script.js"></script>
You should add a leading slash (/) to the path like below:
<link rel="stylesheet" type="text/css" href="/style.css">
<script src="/script.js"></script>
or could be better use asset() to use a full URL
<link rel="stylesheet" type="text/css" href="{{asset('css/layouts/style-horizontal.css')}}">
<script src="{{asset('js/plugins.js')}}"></script>
I'm trying to create a website MVC with PHP and TinyButStrong. Everything works just fine except that CSS code does not work with TinyButStrong. Anyone knows the problem here?
file example.html
<head>
<link rel="stylesheet" type="text/css" href="css/style.css" media="screen" />
</head>
<body>
<p>[onshow.msg]</p>
</body>
file php
<?php
include "tbs_class.php";
$tbs = new clsTinyButStrong;
$msg = "example tbs";
$tbs->LoadTemplate("example.html");
$tbs->Show();
?>
I have a simple MVC project and I want to start design it with CSS file,
I created a Style/StyleSheet.css file with this content:
body {
background-color:green;
}
and added the link to it inside _Layout.cshtml, with this line:
<link href="#Url.Content("~/Style/StyleSheet.css")" rel="stylesheet" type="text/css" />
I don't see any change of the background color, what am I doing wrong ?
Help will be Appreciated ! Thanks !
Try basic html:
<link href="/Style/StyleSheet.css" rel="stylesheet" type="text/css" />
or change "..." inside the string to '...' :
<link href="#Url.Content('~/Style/StyleSheet.css')" rel="stylesheet" type="text/css" />
I'm using Play framework.
In a template it is possible to do the following to include css.
<link rel="stylesheet" media="screen" href="#routes.Assets.at("stylesheets/main.css")">
But what I would like to do is to include the css right into the webpage
<style>#[include the static file contents]</style>
Is that possible?
As others mentioned it is NOT preferred way, anyway you can use common 'tags' technique for doing this,
just create a file views/tags/yourStyles.scala.html with content:
<style>
* {
background: orange;
}
</style>
so in your template/view you can use it as (sample):
<head>
<title>#title</title>
<link rel="stylesheet" media="screen" href="#routes.Assets.versioned("stylesheets/main.css")">
<link rel="shortcut icon" type="image/png" href="#routes.WebJarAssets.at("images/favicon.png")">
#tags.yourStyles() <!-- <-here ->
</head>
<head>
...
<link href="static/css/bootstrap.css" rel="stylesheet">
<lift:dynamicStile></lift:dynamicStile> //???
...
</head>
I'll answer with the brevity of your question:
https://github.com/lift/framework/blob/master/web/webkit/src/main/scala/net/liftweb/builtin/snippet/CSS.scala