How to Add Background Images in WordPress – as Like CSS

PHP code cannot run in .css file, however you can use inline style, such as: [php]<div style="background-image: url("<?php //url ?>");">[/php] OR [css].class-name { background-image: url("<?php //url ?>"); }[/css] The above would be useful when working with custom fields for dynamic image paths. If the image is located in the theme directory, PHP won’t be needed, let’s say … Read more

‘hr’ right aligned next to text – CSS

Explanation: Here, the main part is to use overflow: hidden; on the element, and than am creating a virtual element using an :after pseudo with content property, and am positioning it absolute to the parent element which am setting to relative [php]<h2>Hello World</h2>[/php]   [css]h2 { font-size: 20px; font-family: Arial; position: relative; overflow: hidden; } h2:after { display: inline-block; content: ""; height: 4px; background: … Read more