Domanda

I wanna implement this idea by css : enter image description here

What is the best approach to do that in CSS ? Thanks very much !!

UPDATE

I've did this trick before with Headings , More information here : Putting Heading within 2 horizontal lines in CSS

But when i tried to edit the heading version also didn't work with buttons .

È stato utile?

Soluzione

http://jsfiddle.net/pB9MY/

body { background: #fff;  }

h3 {
  width: 500px;
  font: 30px Arial;
  font-weight: normal; 
  text-align: right;
  position: relative;
}

h3 span {
  background: #fff; 
  margin-right: 15%;
  padding: 0 20px;
}

h3:before {
  content: "";
  width: 100%;
  left: 0;
  top: 50%;
  position: absolute;
  z-index: -1;
  height: 0;
  border-top: 8px solid grey;
  opacity:.2
}
button{
  background-color:green;
  border:1px solid green;
  border-radius:5px;
  vertical-align:center;
}
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  <h3><span><button>Hello</button></span></h3>
</body>
</html>

Altri suggerimenti

Is this what you're after?

Create a div for the text...

<div class="rightrounded">Some Text</div>

And apply the appropriate css...

.rightrounded {
    width: 100px;
    float: right;
    border-radius: 5px;
    background-color: #008000;
    color: #fff;
    text-align: center;
}

Fiddle here

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top