CSS Banners

Size
2,548 Kb
Views
46,552

How do I make an css banners?

Attempting to use pseudo elements and other CSS trickery to make the classic banner shape with just code. Useful for designers who like to do odd things ;). What is a css banners? How do you make a css banners? This script and codes were developed by Jon Christensen on 03 August 2022, Wednesday.

CSS Banners Previews

CSS Banners - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CSS Banners</title> <script src="http://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ h1 { font-family: sans-serif; font-weight: bold; position: relative; display: inline-block; color: #fff; padding: 0; margin-left: 1em;
}
h1:after,
h1:before { content: ""; border: 2px solid navy; background: #000; position: absolute; height: 100%; width: 100%; left:0; top:0; z-index: -1; box-sizing: border-box;
}
h1:after { transform: skewX(30deg)
}
h1:before { transform: skewX(-30deg);
}
span { background: #000; padding: 1em; display: block; margin: 2px;
}
h1:before, h1:after, span {
background: linear-gradient(to bottom, #1e5799 0%,#7db9e8 100%); /* W3C */
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <h1>TEST HEADING</h1>
<p>&nbsp;</p>
<h1><span>TEST HEADING</span></h1> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

CSS Banners - Script Codes CSS Codes

h1 { font-family: sans-serif; font-weight: bold; position: relative; display: inline-block; color: #fff; padding: 0; margin-left: 1em;
}
h1:after,
h1:before { content: ""; border: 2px solid navy; background: #000; position: absolute; height: 100%; width: 100%; left:0; top:0; z-index: -1; box-sizing: border-box;
}
h1:after { transform: skewX(30deg)
}
h1:before { transform: skewX(-30deg);
}
span { background: #000; padding: 1em; display: block; margin: 2px;
}
h1:before, h1:after, span {
background: linear-gradient(to bottom, #1e5799 0%,#7db9e8 100%); /* W3C */
}

CSS Banners - Script Codes JS Codes

// NO JS HERE! :)
// But, it would be a good idea to include some styles with Modernizr for fallbacks or some sort of JS polyfill.
CSS Banners - Script Codes
CSS Banners - Script Codes
Home Page Home
Developer Jon Christensen
Username JMChristensen
Uploaded August 03, 2022
Rating 3
Size 2,548 Kb
Views 46,552
Do you need developer help for CSS Banners?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Jon Christensen (JMChristensen) Script Codes
Create amazing blog posts with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!