How to beautify selection using pure css? Code implementation of css beautification select

不言
Release: 2018-08-28 10:37:44
Original
4840 people have browsed it

The content of this article is about how to use pure CSS to beautify select? The code implementation of css beautification select has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

The renderings are as follows:

<h2>Cars Select</h2>
    <div class="select">
        <select name="cars">
            <option value="volvo">Volvo</option>
            <option value="saab">Saab</option>
            <option value="opel" selected>Opel</option>
            <option value="audi">Audi</option>
        </select>
    </div>
Copy after login
	body {
		font-size: 20px;
		color: #090;
		background-color: #eee;
		text-align: center;
	}
	.select {
		display: inline-block;
		width: 300px;
		position: relative;
		vertical-align: middle;
		padding: 0;
		overflow: hidden;
		background-color: #fff;
		color: #555;
		border: 1px solid #aaa;
		text-shadow: none;
		border-radius: 4px;	
		transition: box-shadow 0.25s ease;
		z-index: 2;
	}

	.select:hover {
		box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
	}

	.select:before {
		content: "";
		position: absolute;
		width: 0;
		height: 0;
		border: 10px solid transparent;
		border-top-color: #ccc;
		top: 14px;
		right: 10px;
		cursor: pointer;
		z-index: -2;
	}
	.select select {
		cursor: pointer;
		padding: 10px;
		width: 100%;
		border: none;
		background: transparent;
		background-image: none;
		-webkit-appearance: none;
		-moz-appearance: none;
	}

	.select select:focus {
		outline: none;
	}
Copy after login

Related recommendations:

css beautification with jquery select_jquery

css beautification, optimization, and merging tool recommendations_html/css_WEB-ITnose

js css to achieve select beautification effect_javascript skills

The above is the detailed content of How to beautify selection using pure css? Code implementation of css beautification select. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!