search
HomeWeb Front-endHTML Tutorialcss小技巧 - 我_爱编程

网页字体

font-size: 16px;<span style="color: #800000;">font-family: "Microsoft Yahei", Arial, Helvetica, sans-serif; 网络常用来显高大上的名言警句字体 </span>
<span style="color: #800000;">font: 12px "宋体", Arial, Helvetica, sans-serif; 普通内容字体<br><span class="styles-clipboard-only"> <span class="webkit-css-property">color: <span class="expand-element"><span class="value"><span><span class="color-swatch"><span class="color-swatch-inner">#474645; 内容小标题 以及内容<br> line-height: 20px 内容行高<br></span></span></span></span></span></span></span></span>
  1. font-weight: bold; 字体加粗
  • color: #838383;
  • background: #f6f6f6; 颜色较浅的地方
<span style="color: #800000;"> </span>

选择器

<span style="color: #800000;">.texts p:nth-child(2)</span>{}<span style="color: #800000;"> :取texts 类下的第二个p
:hover </span>{}<span style="color: #800000;">:当鼠标移到</span>

动画控制

    <span style="color: #008000;">/*</span><span style="color: #008000;"> -webkit-transition: all 1s; </span><span style="color: #008000;">*/</span><span style="color: #800000;">
    -moz-transition: all 1s;       
    -o-transition: all 1s;
    transition: all 1s;        /*动画共1秒
    </span><span style="color: #008000;">/*</span><span style="color: #008000;"> -webkit-transform: translate(60px); </span><span style="color: #008000;">*/</span><span style="color: #800000;">
    -moz-transform: translate(60px);        /*沿x轴向右移60px*/
    -o-transform: translate(60px);
    -ms-transform: translate(60px);
    </span><span style="color: #008000;">/*</span><span style="color: #008000;"> transform: translate(60px); </span><span style="color: #008000;">*/<br></span><span style="color: #888888;">-moz-transform: scale(1.1)      图片放大</span><span style="color: #008000;"><br><br></span>

整体效果调整

<span style="color: #800000;">letter-spacing: 2px;  字与字间隔2px
text-shadow:0px 1px rgba(255,255,255,0.3) 字阴影
 box-shadow: #999 4px 5px 1px;  块区域阴影<br>overflow: hidden; 多余部分隐藏<br></span>border-radius: 100%;<span style="line-height: 1.5;">overflow: </span><span style="line-height: 1.5;">hidden; 变成圆形后 ,需设置内容隐藏<br><span class="webkit-css-property">border-radius: <span class="expand-element"><span class="value">0 20px 20px 0;  右半圆<br><span class="styles-clipboard-only"> <span class="webkit-css-property">box-shadow: <span class="expand-element"><span class="value">-2px -1px 5px <span><span class="color-swatch"><span class="color-swatch-inner">#666;</span></span></span></span></span></span></span><br></span></span></span><br></span>
<span style="color: #800000;"> </span>

扩展知识

<span style="color: #800000;">line-height: 28px;  为达效果,当高度不能更改时,可以试着用行高<br><span class="webkit-css-property">display: <span class="expand-element"><span class="value">block  如果未达效果,试着设置</span></span></span><br><span style="font-size: 13px;"><strong><span class="styles-clipboard-only"><span class="webkit-css-property">border-bottom: <span class="expand-element"><span class="value"><span class="color-swatch"><span class="color-swatch-inner">#474645 2px solid; 画一条线<br>margin: 0 20px 20px 20px  上 右 下 左<br></span></span></span></span></span></span></strong></span></span><strong>margin: 20px auto   上下  左右<br></strong><strong>margin:   20px 20px </strong><strong> 20px  上  左右  下<br>阅读全文>> 伪元素:给部分整体前添加 元素 并控制</strong>
<span style="color: #800000;">.blogs::before </span>{<span style="color: #ff0000;"> content</span>:<span style="color: #0000ff;"> ""</span>;<span style="color: #ff0000;"> width</span>:<span style="color: #0000ff;"> 10px</span>;<span style="color: #ff0000;"> height</span>:<span style="color: #0000ff;"> 10px</span>;<span style="color: #ff0000;"> border-radius</span>:<span style="color: #0000ff;"> 50%</span>;<span style="color: #ff0000;"> position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;"> background</span>:<span style="color: #0000ff;"> #cac1c1</span>;<span style="color: #ff0000;"> border</span>:<span style="color: #0000ff;"> 2px solid #fff</span>;<span style="color: #ff0000;"> left</span>:<span style="color: #0000ff;"> -27px</span>;<span style="color: #ff0000;"> -webkit-transition</span>:<span style="color: #0000ff;"> all 1s</span>;<span style="color: #ff0000;"> -moz-transition</span>:<span style="color: #0000ff;"> all 1s</span>;<span style="color: #ff0000;"> -o-transition</span>:<span style="color: #0000ff;"> all 1s</span>;<span style="color: #ff0000;"> transition</span>:<span style="color: #0000ff;"> all 1s</span>; }<span style="color: #800000;">
.blogs:hover::before </span>{<span style="color: #ff0000;"> background</span>:<span style="color: #0000ff;"> #474645 </span>}<span style="color: #800000;">
.dateview </span>{<span style="color: #ff0000;"> position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;"> left</span>:<span style="color: #0000ff;"> -125px</span>;<span style="color: #ff0000;"> top</span>:<span style="color: #0000ff;"> 0px</span>;<span style="color: #ff0000;"> z-index</span>:<span style="color: #0000ff;"> 1</span>;<span style="color: #ff0000;"> color</span>:<span style="color: #0000ff;"> #F5F5F5</span>; }<span style="color: #800000;">
.blogs::after </span>{<span style="color: #ff0000;"> content</span>:<span style="color: #0000ff;"> ""</span>;<span style="color: #ff0000;"> width</span>:<span style="color: #0000ff;"> 121px</span>;<span style="color: #ff0000;"> height</span>:<span style="color: #0000ff;"> 29px</span>;<span style="color: #ff0000;"> position</span>:<span style="color: #0000ff;"> absolute</span>;<span style="color: #ff0000;"> left</span>:<span style="color: #0000ff;"> -148px</span>;<span style="color: #ff0000;"> top</span>:<span style="color: #0000ff;"> -9px</span>;<span style="color: #ff0000;"> z-index</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> background</span>:<span style="color: #0000ff;"> #474645 url(../images/ti.png) no-repeat</span>;<span style="color: #ff0000;"> opacity</span>:<span style="color: #0000ff;"> 0</span>;<span style="color: #ff0000;"> -webkit-transition</span>:<span style="color: #0000ff;"> all 1s</span>;<span style="color: #ff0000;"> -moz-transition</span>:<span style="color: #0000ff;"> all 1s</span>;<span style="color: #ff0000;"> -o-transition</span>:<span style="color: #0000ff;"> all 1s</span>;<span style="color: #ff0000;"> transition</span>:<span style="color: #0000ff;"> all 1s</span>; }<span style="color: #800000;">
.blogs:hover::after </span>{<span style="color: #ff0000;"> opacity</span>:<span style="color: #0000ff;"> 1 </span>}<br>或者:
<span style="color: #800000;">a:before
</span>{ <code>content: " (" attr(href) ")";</code>}

 a伪元素

<span style="color: #800000;">选择未访问、已访问、悬浮和活动链接,并设置它们的样式:
a:link    </span>{<span style="color: #ff0000;">color</span>:<span style="color: #0000ff;">blue</span>;}<span style="color: #800000;">
a:visited </span>{<span style="color: #ff0000;">color</span>:<span style="color: #0000ff;">blue</span>;}<span style="color: #800000;">
a:hover   </span>{<span style="color: #ff0000;">color</span>:<span style="color: #0000ff;">red</span>;}<span style="color: #800000;">
a:active  </span>{<span style="color: #ff0000;">color</span>:<span style="color: #0000ff;">yellow</span>;}

 

 

 结尾:给自己的的页面设置分享按钮 例如:分享到QQ 、新浪 、人人、微信 等等  

分享按钮-百度分享

它会告诉你

Statement
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
The Future of HTML, CSS, and JavaScript: Web Development TrendsThe Future of HTML, CSS, and JavaScript: Web Development TrendsApr 19, 2025 am 12:02 AM

The future trends of HTML are semantics and web components, the future trends of CSS are CSS-in-JS and CSSHoudini, and the future trends of JavaScript are WebAssembly and Serverless. 1. HTML semantics improve accessibility and SEO effects, and Web components improve development efficiency, but attention should be paid to browser compatibility. 2. CSS-in-JS enhances style management flexibility but may increase file size. CSSHoudini allows direct operation of CSS rendering. 3.WebAssembly optimizes browser application performance but has a steep learning curve, and Serverless simplifies development but requires optimization of cold start problems.

HTML: The Structure, CSS: The Style, JavaScript: The BehaviorHTML: The Structure, CSS: The Style, JavaScript: The BehaviorApr 18, 2025 am 12:09 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML defines the web page structure, 2. CSS controls the web page style, and 3. JavaScript adds dynamic behavior. Together, they build the framework, aesthetics and interactivity of modern websites.

The Future of HTML: Evolution and Trends in Web DesignThe Future of HTML: Evolution and Trends in Web DesignApr 17, 2025 am 12:12 AM

The future of HTML is full of infinite possibilities. 1) New features and standards will include more semantic tags and the popularity of WebComponents. 2) The web design trend will continue to develop towards responsive and accessible design. 3) Performance optimization will improve the user experience through responsive image loading and lazy loading technologies.

HTML vs. CSS vs. JavaScript: A Comparative OverviewHTML vs. CSS vs. JavaScript: A Comparative OverviewApr 16, 2025 am 12:04 AM

The roles of HTML, CSS and JavaScript in web development are: HTML is responsible for content structure, CSS is responsible for style, and JavaScript is responsible for dynamic behavior. 1. HTML defines the web page structure and content through tags to ensure semantics. 2. CSS controls the web page style through selectors and attributes to make it beautiful and easy to read. 3. JavaScript controls web page behavior through scripts to achieve dynamic and interactive functions.

HTML: Is It a Programming Language or Something Else?HTML: Is It a Programming Language or Something Else?Apr 15, 2025 am 12:13 AM

HTMLisnotaprogramminglanguage;itisamarkuplanguage.1)HTMLstructuresandformatswebcontentusingtags.2)ItworkswithCSSforstylingandJavaScriptforinteractivity,enhancingwebdevelopment.

HTML: Building the Structure of Web PagesHTML: Building the Structure of Web PagesApr 14, 2025 am 12:14 AM

HTML is the cornerstone of building web page structure. 1. HTML defines the content structure and semantics, and uses, etc. tags. 2. Provide semantic markers, such as, etc., to improve SEO effect. 3. To realize user interaction through tags, pay attention to form verification. 4. Use advanced elements such as, combined with JavaScript to achieve dynamic effects. 5. Common errors include unclosed labels and unquoted attribute values, and verification tools are required. 6. Optimization strategies include reducing HTTP requests, compressing HTML, using semantic tags, etc.

From Text to Websites: The Power of HTMLFrom Text to Websites: The Power of HTMLApr 13, 2025 am 12:07 AM

HTML is a language used to build web pages, defining web page structure and content through tags and attributes. 1) HTML organizes document structure through tags, such as,. 2) The browser parses HTML to build the DOM and renders the web page. 3) New features of HTML5, such as, enhance multimedia functions. 4) Common errors include unclosed labels and unquoted attribute values. 5) Optimization suggestions include using semantic tags and reducing file size.

Understanding HTML, CSS, and JavaScript: A Beginner's GuideUnderstanding HTML, CSS, and JavaScript: A Beginner's GuideApr 12, 2025 am 12:02 AM

WebdevelopmentreliesonHTML,CSS,andJavaScript:1)HTMLstructurescontent,2)CSSstylesit,and3)JavaScriptaddsinteractivity,formingthebasisofmodernwebexperiences.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

VSCode Windows 64-bit Download

VSCode Windows 64-bit Download

A free and powerful IDE editor launched by Microsoft

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools