-
TIP-0015
CSS Attribute Selector
-
Select HTML elements based on attributes using the attribute selector.
-
<a href="">HTML</a> <a>CSS</a> <a href="">JavaScript</a> /* π targets all a elements that have a href attribute */ a[href] { color: crimson; }
-
TIP-0014
CSS Rainbow Animation
-
Creates a continuously looping color animation for elements to grab user attention. Give a read to css tips tricks repository to learn when to use prefer-reduced-motion media feature
-
button{ animation: rainbow-animation 200ms linear infinite; } @keyframes rainbow-animation { to{ filter: hue-rotate(0deg); } from{ filter: hue-rotate(360deg); } }
-
TIP-0013
CSS Change Writing Mode
-
You can use writing mode property to specify how text should be laid out on your website i.e vertically or horizontally.
-
<h1>Cakes & Bakes</h1> /* π‘ specifies the text layout direction to sideways-lr */ h1 { writing-mode: sideways-lr; }
-
TIP-0012
CSS Fallback values for Variables
-
-
/* π¨ crimson color will be applied as var(--black) is not defined */ :root { --orange: orange; --coral: coral; } h1 { color: var(--black, crimson); }
-
TIP-0011
CSS Style Drop Caps
-
Avoid unnecessary spans and use pseudo elements instead to style your content likewise first-letter pseudo-element we also have first-line pseudo-element.
-
h1::first-letter{ font-size: 2rem; color:#ff8A00; }
-
TIP-0010
CSS Emphasing Text
-
Use text-emphasis property to apply emphasis marks to text elements.You can specify any string including emojis as its value.
-
h1 { text-emphasis: "β°"; }
-
TIP-0009
CSS Paused Pseudo Class
-
Use :paused selector to style media elements when in paused state likewise :paused we also have :playing.
-
/* π’ currently, only supported in Safari */ video:paused { opacity: 0.6; }
-
TIP-0008
CSS Fill Text With Image
-
You can fill your text with image
-
h3{ background-image: url('images/rose.jpg'); background-clip: text; color: transparent; background-color: white; }
-
TIP-0007
CSS The Custom Cursors
-
you can set your custom cursor
-
Β Checkout the github repository css tips tricks to learn more about it.Β
html{ cursor:url('no.png'), auto; }
-
TIP-0006
Laravel String Snake
-
The Str::snake method converts the given string to snake_case:
-
use Illuminate\Support\Str; $converted = Str::snake('fooBar'); // foo_bar $converted = Str::snake('fooBar', '-'); // foo-bar
-
TIP-0005
Laravel String Trim
-
The Str::trim method strips whitespace (or other characters) from the beginning and end of the given string. Unlike PHP's native trim function, the Str::trim method also removes unicode whitespace characters:
-
use Illuminate\Support\Str; $string = Str::trim(' foo bar '); // 'foo bar'
-
TIP-0004
Laravel String Transliterate
-
The Str::transliterate method will attempt to convert a given string into its closest ASCII representation:
-
use Illuminate\Support\Str; $email = Str::transliterate('β£ββ’β£@βββ‘ββ₯ββ.βββ'); // 'test@laravel.com'
-
TIP-0003
Laravel String to html string
-
The Str::toHtmlString method converts the string instance to an instance of Illuminate\Support\HtmlString, which may be displayed in Blade templates:
-
use Illuminate\Support\Str; $htmlString = Str::of('Nuno Maduro')->toHtmlString();
-
TIP-0002
Laravel String to Base64
-
The Str::toBase64 method converts the given string to Base64:
-
use Illuminate\Support\Str; $base64 = Str::toBase64('Laravel'); // TGFyYXZlbA==
-
TIP-0001
Laravel Ajax Render View
-
Rendering laravel blade view using ajax from controller to HTML DOM.
-
In your controller
public function getView(Request $request) { // Fetch any required data $data = [ 'key' => 'value', // Example data ]; // Render the view $view = view('your-blade-view', $data)->render(); // Return the rendered view as a JSON response return response()->json(['html' => $view]); }
In your view file
<div id="render-html"></div> <script> $.ajax({ url: '/get-view', type: 'POST', data: { _token: $('meta[name="csrf-token"]').attr('content'), // CSRF token someData: 'value', // Optional data }, success: function(response) { $('#render-html').html(response.html); // Update content }, error: function(xhr, status, error) { console.error('Error:', error); } }); </script>