Div and CSS implement dashed borders | CSS dashed underline and dashed line method

Source: Internet
Author: User
Tags dashed line
This article mainly covers the implementation of dashed borders on div and CSS | CSS dashed underline and dotted line method, has a certain reference value, now share to everyone, the need for friends can refer to

This is where the dashed border border the border property to control the dash

1. CSS Border Dashed-TOP
This is where the dashed border of the border property is border control. The following settings for CSS Heights (CSS height) and css widths (CSS width) are 350 pixels for easy viewing to demonstrate other meanings.

One or four edges are dashed borders

border:1px dashed #000; Black dashed border [code/]

Instance:
CSS code:

[code].pcss5{border:1px dashed #000; height:50px;width:350px}

HTML code:

<p class= "PCSS5" > My four-sided black dashed border </p>

This sets the border abbreviation to define the black dashed border of the PCSS5 selector with a four-sided border of 1px.

Two, the left is a dashed line:

CSS code:

. pcss5-1{border-left:1px dashed #000; height:50px;width:350px}

HTML code:

<p class= "Pcss5-1" > My left is a dashed black border </p>

This sets the left side as a dashed black border

Three, the right is dashed:

CSS code:

. pcss5-2{border-right:1px dashed #000; height:50px;width:350px}

HTML code:

<p class= "Pcss5-2" > My right side is black dashed border </p>

This sets the black dashed border to the right side

Four, the top edge (top) is a dashed line:

CSS code:

. pcss5-3{border-top:1px dashed #000; height:50px;width:350px}

HTML code:

<p class= "pcss5-3" > My top is a black dashed border </p>

This sets the top edge (upper edge) side as a black dashed border

Five, bottom edge (bottom) is dashed:

CSS code:

. pcss5-4{border-bottom:1px dashed #000; height:50px;width:350px}

HTML code:

<p class= "Pcss5-4" > My bottom is a black dashed border </p>

This sets the bottom (bottom edge) side as a dashed black border

Six, any side is not a dashed line, the other three-sided dashed situation

Joins the right border without a dashed line and no edges, and the other three sides are dashed black borders

CSS code:

. pcss5-5{border:1px dashed #000; border-right:0; height:50px;width:350px}

HTML code:

<p class= "pcss5-5" > My right Border is no edge and the other three sides are black dashed border instances </p> here by first set the object four edges of the black 1px dashed border, followed by setting the edge of the 0 setting, This is equivalent to setting a 3 edge border dashed property, but note here that the Border property is set before and after the order. The complete P+CSS code for the above example is as follows: <! DOCTYPE html> 

2. Hyperlink dashed underline-TOP

We often set the text content to be linked or underlined with a dotted line, or the mouse moved to a linked text appears dashed underline, this how to achieve it, here is about CSS hyperlinks to the dashed underline.

One, with linked text with dashed underline

This is also the CSS style that controls the hyperlink a object through the CSS border border property.

Demo CSS Code:

a{border-bottom:1px dashed #111;} /* Here set the dotted underline below the text with the link */
a:hover{border:0;} /* This setting does not show a dashed line when the mouse is linked text */

Full div CSS Code:

<! DOCTYPE html> 

Description: Text-decoration:none; This is to remove the CSS underline (the hyperlink default comes with the underline attribute)

The above is a dashed underline for text with CSS hyperlinks.

When the mouse is placed on the linked text, a dashed underline appears.

This is similar to the above, just remove the underline for hyperlink A, and underline the dotted border below the CSS text when the mouse passes.

Corresponding CSS code:

A{text-decoration:none;} [/code]a:hover{border-bottom:1px dashed #111;} [/code]

This is achieved, you might want to try the hyperlink underline instance.

3, List-style CSS dashed underline-TOP

Often when they touch CSS Li, they want this CSS list style to split the dotted line below each row

Here we only need to set the bottom border of Li to a dashed border.

First, we set up CSS code in the case of CSS initialization:

li{border-bottom:1px dashed #111;}

You can implement Li's list-based content such as dashed-line-separated effects (a dashed border at the bottom of each Li content)
And we often meet Li's bottom dotted line is small as a point so small, and border is very difficult to achieve, this time we need a dotted line of the picture can (side 1 pixels wide 3 pixels of 1 pixel color picture can be achieved)

Corresponding CSS Li code:

Li{background:url (point picture Path) repeat-x 0 Bottom}

Here is no longer a detailed demonstration of our VIP also for everyone in detail and demonstrate the production of various Li CSS knowledge points.

4. CSS defines a horizontal dashed line-TOP

Well, that's a good idea. You can also use a dashed line on the P object to achieve horizontal dashed split lines by setting the dashed attribute on the HR horizontal label.

The following can be taken here:

Set the horizontal dashed line to P:

. pcss5{height:1px; width:100%; border-bottom:1px dashed #000;}

Corresponding HTML code:

<p class= "PCSS5" ></p>

To set properties on the HR horizontal split line:

First, set the dashed attribute within the HR tab:


This shows that the size is the value of HR and one side is set to 1.

The second CSS property that defines HR in CSS code or CSS files

HR {border-top:1px dashed #00F;}

corresponding HTML within the HR header code:

<HR size=1>

Here is the set of HR border to the top or bottom of any one edge of 1 pixels of a blue dashed border, and set the HR size of 1, and the first value is roughly the same, the only difference is that when the HR tag appears in HTML, the HR tag attribute is set to CSS, if the page appears multiple times can reduce the amount of code.

The above is the whole content of this article, I hope that everyone's learning has helped, more relevant content please pay attention to topic.alibabacloud.com!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.