HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div class="box">
<div class="select-ui li-slt">
<h3><a href="#select-list">Family Site</a></h3>
<ul id="select-list">
<li><a href="#none" title="새창 열림">Family Site</a></li>
<li><a href="#none" title="새창 열림">네이버</a></li>
<li><a href="#none" title="새창 열림">다음</a></li>
<li><a href="#none" title="새창 열림">skB</a></li>
</ul>
</div>
</div>
* {margin: 0;padding: 0;}
.box {
margin: 100px auto;
width: 500px;
}
.select-ui {
position: relative;
width: 120px;
}
.select-ui h3 a {
z-index: 10;
position: relative;
display: block;
width: 120px;
padding: 5px 0 5px 10px;
font-size: 12px;
font-weight: normal;
line-height: 1;
color: #686c73;
text-decoration: none;
background: #fff url('http://cfile7.uf.tistory.com/image/2225203756944C371A093B') no-repeat 95% 50%;
border: 1px solid #c8c8c8;
}
.select-ui h3 a.on {
background: url('http://cfile27.uf.tistory.com/image/26242F3756944C39246B9D') no-repeat 95% 50%;
}
.select-ui h3 a:hover {
text-decoration: none;
color: #df2428
}
.select-ui ul {
display: none;
position: absolute;
width: 130px;
max-height: 50px;
overflow: hidden;
overflow-y: scroll;
left: 0;
padding: 7px 0 7px;
border: 1px solid #c8c8c8;
background: #fff;
}
.select-ui ul li {
display: inline;
float: left;
width: 100%;
}
.select-ui ul li a {
display: block;
padding: 3px 10px 2px;
color: #686c73;
font-size: 11px;
line-height: 1.37;
text-decoration: none;
}
.select-ui ul li a:hover {
color: #df2428;
text-decoration: none;
background: #eff5ff;
}
$.extend($.fn, {
selectUi : function(opts){
$.fn.selectUi.defaults = {
showToTop: false, // list 위에서 보여질때 true, 디폴트는 아래도 나옴
arrow : true, // 화살표 활성화 (css class on 으로 설정)
duration: 400, // 슬라이드 속도 컨트롤
listDuration : 200, // 리스트 항목 클릭 후 사라질 때 속도 컨트롤
listItems :7, // 리스트 항목의 보여줄 갯수 설정
listWid : false, // 리스트 width 값이 클때 true로 설정 후 아래의 listWidVal 값으로 width 설정 (두가지 옵션은 셋트임)
listWidVal : 200
};
return this.each(function(){
opts = $.extend( {}, $.fn.selectUi.defaults, opts || {});
var _self = $(this),
target = _self.find('h3 > a');
list = _self.find('ul');
function listHide(drt) {
list.slideUp(drt)
}
function rmClass() {
if(opts.arrow) {
target.removeClass('on')
}
}
target.on('click', function(){
if(list.is(':hidden')) {
list.slideDown(opts.duration);
var liHeight = list.find('li a').innerHeight();
list.css({'max-height': (liHeight * opts.listItems) - 5 });
if(opts.arrow) {
$(this).addClass('on')
}
} else {
listHide(opts.duration);
rmClass();
}
return false;
});
list.on('click','li a', function(){
listHide(opts.listDuration);
var clkText = $(this).text();
target.text(clkText);
rmClass();
});
if(opts.showToTop) {
list.css({bottom:23})
} else {list.css({top:23})}
if(opts.listWid) {
list.css({width: opts.listWidVal})
}
/* 셀렉터 컴포넌트를 벗어났을 때 */
_self.on({
'mouseleave' : function() {
listHide(opts.duration);
rmClass();
}
})
})
}
});
$('.li-slt').selectUi();
Also see: Tab Triggers