I have problem, I can't align two buttons in one line.
I tried to set padding of span class pptext2 but without success.
Here is code
http://jsfiddle.net/71782p4L/1/
HTML
<div class="ppdiv">
<button class="ppenvelope"><img src="http://i.imgur.com/RfLMyak.jpg" alt="Slika"></button><button class="pptext"><span class="pptext2">PRIVATE MESSAGE</span></button>
</div><!--Zatvoren ppdiv-->
CSS
.ppdiv{
padding-top:22px;
padding-left: 19px;
}
.ppdiv img{
padding:10px;
font-size: 20px;
}
.ppenvelope{
border:none;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
background: #b2d4dd;
}
.pptext{
border:none;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
background: #c9e0e6;
}
.pptext2{
display: inline-block;
color:#4c6974;
padding-top: 15px;
padding-bottom:13px;
padding-left: 13px;
}
I would set float: left; on both buttons and overflow: hidden; on .ppdiv. To make sure both buttons stay the same height, also set height on them (e.g. height: 48px;). You can also remove the span.pptext2 element altogether, unless you need it for other purposes. Take a look at the fiddle: https://jsfiddle.net/igi33/ck4w6cLq/1/.
HTML:
<div class="ppdiv">
<button class="ppenvelope">
<img src="http://i.imgur.com/RfLMyak.jpg" alt="Slika">
</button>
<button class="pptext">PRIVATE MESSAGE</button>
</div>
CSS:
.ppdiv{
overflow: hidden;
}
.ppenvelope, .pptext {
float: left;
border: none;
height: 48px;
}
.ppenvelope{
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
background: #b2d4dd;
}
.ppdiv img{
padding:10px;
}
.pptext{
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
background: #c9e0e6;
color:#4c6974;
}
Use vertical-align: middle; on both buttons.
.pptext {
background: none repeat scroll 0 0 #c9e0e6;
border: medium none;
border-bottom-right-radius: 4px;
border-top-right-radius: 4px;
vertical-align: middle;
}
.ppenvelope {
background: none repeat scroll 0 0 #b2d4dd;
border: medium none;
border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
vertical-align: middle;
}
https://jsfiddle.net/71782p4L/2/
Here you are.
.ppdiv {
height:43px;
overflow:hidden;
}
.ppdiv img {
padding:10px;
}
.ppenvelope {
border:none;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
background: #b2d4dd;
float:left;
height:100%; /*Sets height to 100% of current container, of which is ppdiv (43px) */
}
.pptext {
border:none;
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
background: #c9e0e6;
height:100%; /*Sets height to 100% of current container, of which is ppdiv (43px)*/
}
Related
I have the following button on my site:
http://jsfiddle.net/32u5x5uf/
I'd first like to move the span circle to be exactly in the center of the main button. I'd then like if I can somehow "merge" the two shapes together in CSS. So basically remove the top half of the circle and the main bar that cuts through the middle of the circle.
.full-circle {
border: 2px solid #1588CB;
height: 35px;
width: 35px;
-moz-border-radius:30px;
-webkit-border-radius: 30px;
position:absolute;
bottom:-20px;
}
button {
background:#ffffff;
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border: 2px solid #1588CB;
color:#1588CB;
font-weight:400;
height:200px;
width:400px;
position:relative;
}
<button>Learn More
<span class="full-circle">+</span>
</button>
.full-circle {
border: 2px solid #1588CB;
height: 35px;
width: 35px;
-moz-border-radius:30px;
-webkit-border-radius: 30px;
position:absolute;
bottom:-20px;
}
button {
background:#ffffff;
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border: 2px solid #1588CB;
color:#1588CB;
font-weight:400;
height:200px;
width:400px;
position:relative;
}
/* overides ... */
.full-circle {
border-radius: 0 0 30px 30px;
border-top: none;
height: 17px;
background: #FFF;
left: 50%;
margin-left: -17px;
bottom: -19px;
line-height: 0;
}
<button>Learn More
<span class="full-circle">+</span>
</button>
The Answer above by Turnip is actually kind of a cheat with same
background-color
If that's not the case then you should go with this:
div {
background-color: #80C5A0;
width: 200px;
height: 100px;
border-radius: 50% / 100%;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
<div></div>
I am trying to attach a select dropdown to a search box. So far, I kind of got it working on larger monitors:
However, the problem is, when I resize my browser window to < 1100px width, the "Everything" gets cut off:
I tried applying a min-width of e.g. 150px to the dropdown but it doesn't seem to be having any effect. Adding a min-width to the container works, but when I resize the window, the controls break to the next line. I'm guessing that the approach I took (using a nested 12-column grid with no gutters to align the dropdown, text box, and button) isn't the right way to do this.
FIDDLE: https://jsfiddle.net/jh2fgmo7/
How can I attach the select dropdown to the text box but keep a minimum width equivalent to the select box's largest value (using CSS only)?
Update-
This is the desired result when resizing:
CSS
body {
max-width: 100%;
margin-left: auto;
margin-right: auto;
margin-top: 0;
font: normal 16px Arial, Helvetica, Verdana, Geneva;
}
body:after {
content: " ";
display: block;
clear: both;
}
.tbnav {
width: 100%;
float: left;
margin-left: 0;
margin-right: 0;
background: #303030;
min-height: 55px;
}
.tbnav .logo {
width: 11.39241%;
float: left;
margin-right: 1.26582%;
margin-left: 3.16456%;
background: url(/images/tb-logo.gif) no-repeat;
height: 27px;
min-width: 150px;
margin-top: 14px;
}
.tbnav .search {
width: 62.02532%;
float: left;
margin-right: 1.26582%;
}
.tbnav .search .searchcat {
width: 11.01695%;
float: left;
height: 27px;
margin-top: 11.5px;
}
.tbnav .search .searchcat select {
height: 33px;
width: 100%;
-webkit-border-top-left-radius: 6px;
-webkit-border-bottom-left-radius: 6px;
-moz-border-radius-topleft: 6px;
-moz-border-radius-bottomleft: 6px;
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
}
.tbnav .search .searchbox {
width: 78.81356%;
float: left;
margin-right: 0;
margin-left: 0;
height: 27px;
padding: 1px;
padding-left: 5px;
margin-top: 11.5px;
}
.tbnav .search .searchbtn {
width: 6.77966%;
float: left;
height: 27px;
margin-top: 11.5px;
}
.tbnav .search .searchbtn input {
height: 33px;
-webkit-border-top-right-radius: 6px;
-webkit-border-bottom-right-radius: 6px;
-moz-border-radius-topright: 6px;
-moz-border-radius-bottomright: 6px;
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
}
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<div class="tbnav">
<div class="logo"></div>
<div class="search">
<div class="searchcat">
<select name="c">
<option>Everything</option>
</select>
</div>
<input type="text" name="search" class="searchbox" />
<div class="searchbtn">
<input type="submit" class="button button-primary button-small" value="Go" />
</div>
</div>
</div>
</body>
</html>
Personally, I would do .searchcat { position: absolute; }, set it to the desired width, then set .searchbox { padding-left: /*whatever*/; }. As a quick fix. You might throw some Javascript in there if the <select> contents will be variable (i.e. loaded dynamically) just to check what the widest value is.
After some fiddling, I used a basic table and styled it with CSS instead. It works just how I wanted now. Hope this helps someone! (If anyone wants the underlying Sass script, let me know!)
Fiddle
http://jsfiddle.net/dzoppzzL/
CSS
body {
max-width: 100%;
margin-left: auto;
margin-right: auto;
margin-top: 0;
font: normal 16px Arial, Helvetica, Verdana, Geneva;
}
body:after {
content: " ";
display: block;
clear: both;
}
.tbnav {
width: 100%;
float: left;
margin-left: 0;
margin-right: 0;
background: #303030;
min-height: 65px;
}
.tbnav .logo {
width: 150px;
float: left;
margin-right: 1.26582%;
margin-left: 3.16456%;
background: url(/images/tb-logo.gif) no-repeat;
height: 27px;
margin-top: 19px;
}
.tbnav .search {
margin-top: 13px;
border: 0;
padding: 0;
border-spacing: 0;
border-collapse: collapse;
margin-left: 3.16456%;
width: 62.02532%;
float: left;
margin-right: 1.26582%;
}
.tbnav .search .searchcat {
height: 35px;
padding: 0px;
border-right: 1px solid #808080;
-webkit-border-top-left-radius: 6px;
-webkit-border-bottom-left-radius: 6px;
-moz-border-radius-topleft: 6px;
-moz-border-radius-bottomleft: 6px;
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
}
.tbnav .search .searchcat select {
-webkit-border-top-left-radius: 6px;
-webkit-border-bottom-left-radius: 6px;
-moz-border-radius-topleft: 6px;
-moz-border-radius-bottomleft: 6px;
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
background: #f7f7f7;
height: 39px;
width: 150px;
color: #808080;
border: 0;
outline: none;
box-shadow: none;
}
.tbnav .search .searchtxt {
width: 100%;
padding: 0;
}
.tbnav .search .searchtxt .searchbox {
border: 1px solid #FFF;
border-left: 0;
width: 100%;
min-width: 200px;
margin-right: 0;
margin-left: 0;
height: 35px;
padding: 1px;
padding-left: 5px;
outline: none;
box-shadow: none;
}
.tbnav .search .searchbtn {
width: 100px;
height: 35px;
padding-left: 5px;
}
.tbnav .search .searchbtn input {
height: 39px;
-webkit-border-top-right-radius: 6px;
-webkit-border-bottom-right-radius: 6px;
-moz-border-radius-topright: 6px;
-moz-border-radius-bottomright: 6px;
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
}
HTML
<table class="search">
<tr>
<td class="searchcat">
<select name="c" id="catsel">
<option>Everything</option>
</select>
</td>
<td class="searchtxt">
<input type="text" name="search" class="searchbox" />
</td>
<td class="searchbtn">
<input type="submit" class="button button-primary button-small" value="Go" />
</td>
</tr>
</table>
I'm trying to build a facebook like Profile/Cover Layout, but i'm struggling with the correct layout.
What i have so far:
http://jsfiddle.net/kvEBF/
<div class="user_profile_cap">
<div class="user_profile_cover">
<img src="jpgfile" alt=""/>
</div>
<div class="user_profile_headline">
Pull Right Text
</div>
</div>
css
.user_profile_cap {
width: 970;
height: auto 9;
border: 1px solid #DDD;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
}
.user_profile_cover {
img {
width: 970px;
height: 115px;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
}
.user_profile_headline {
padding: 10px;
font-size: 16px;
}
http://jsfiddle.net/kvEBF/
The Desired Layout
I'm struggling on placing the Profile Picture, the Page Title and the Right Text correctly in to this Layout.
Can somebody help me out ?
Like this
working demo
css
.user_profile_cap {
width: 970;
height: auto 13;
border: 1px solid #DDD;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
overflow:hidden;
}
.user_profile_cover {
img {
width: 970px;
height: 115px;
-webkit-border-top-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-moz-border-radius-topleft: 5px;
-moz-border-radius-topright: 5px;
border-top-left-radius: 5px;
border-top-right-radius: 5px;
}
}
.user_profile_headline {
padding: 10px;
font-size: 16px;
}
.user_profile_headline img{
border:1px solid #EEEEEE;
width:124px;
height:124px;
float:left;
margin:-90px 10px 0 0;
position:relative;
z-index:111;
background-color:white;
}
.user_profile_headline h2{
margin:0;
padding:0;
font-size:12px;
font-weight:bold;
display:block;
}
.user_profile_headline span{
font-size:10px;
font-family:verdana;
color:gray;
}
This fluid design works fine on all browsers on my laptop, but on my android and iphone the link button is split between two lines. If I change the width percentage of style (a span) I can get it to work, but then it's width is no longer as wide as the container below it and it's needs to be.
I was assuming that style (a span) could only fill in the area between style (a em) and style (a b), I guess I was wrong.
Thanks in advance for anyone that can help me on this.
Styles
.main_container {
overflow: hidden;
width: 100%;
height: 100%;
background-image: url(../images/bgdots.png);
background-repeat: repeat-x y;
background-attachment: fixed;
background-color: transparent;
padding-bottom: 20px;
}
h2.acc_trigger {
display: block;
margin: 0 0 2px 0;
width: 95%;
height: 30px;
font-size: 1.5em;
font-weight: normal;
text-align: center;
margin-left: auto;
margin-right: auto;
}
a em{
display: block;
float: left;
background: url(../images/navs.png) no-repeat 0 0;
width: 26px;
height: 30px;
}
a span{
display: block;
float: left;
background: url(../images/navs_c.png) repeat-x;
width: 95%;
height: 30px;
}
a b{
display: block;
float: left;
background: url(../images/navs.png) no-repeat -28px 0;
width: 5px;
height: 30px;
}
.acc_container {
margin: 0 0 2px;
overflow: hidden;
font-size: 1.2em;
width: 95%;
clear: both;
background: #fff;
border: 2px solid #3cf;
-webkit-border-bottom-right-radius: 5px;
-webkit-border-bottom-left-radius: 5px;
-moz-border-radius-bottomright: 5px;
-moz-border-radius-bottomleft: 5px;
border-bottom-right-radius: 5px;
border-bottom-left-radius: 5px;
-webkit-border-top-right-radius: 5px;
-webkit-border-top-left-radius: 5px;
-moz-border-radius-topright: 5px;
-moz-border-radius-topleft: 5px;
border-top-right-radius: 5px;
border-top-left-radius: 5px;
margin-left: auto;
margin-right: auto;
}
Example HTML
<h2 class="acc_trigger">
<a href="#"><em> </em> <span>
home</span> <b> </b></a>
</h2>
<div class="acc_container">
<h3>
Content content content!
</h3>
<p>
Content and more content, content with style and interest
that makes you want to read on.
</p>
</div>
add in style float:left might resolve your issue
You want your to have a percentage as well. I assume you want the code to work like my example here
a em{
display: block;
float: left;
background: url(../images/navs.png) no-repeat 0 0;
width: 2%;
height: 30px;
}
a b{
display: block;
float: left;
background: url(../images/navs.png) no-repeat -28px 0;
width: 2%;
height: 30px;
}
Basically 95% plus 26px plus 26px can equal > the screen. So it wraps. You want all three of those elements to have a percentage to keep it jiving.
You don't need inline styles if you are using CSS
<h2 class="acc_trigger">
<em> </em> <span> home</span> <b> </b>
</h2>
should be
<h2 class="acc_trigger">home</h2>
a.acc_trigger{
font-style:italic;
font-weight: bold;
}
H2 is a block-level element. If you want to make it inline just do this:
<h2 class="acc_trigger">home</h2>
a.acc_trigger{
font-style:italic;
font-weight: bold;
display: inline;
}
html:
<div class="no-contact-info">
<textarea></textarea>
<span>no contact info</span>
</div>
css:
.no-contact-info {
width: 400px;
}
.no-contact-info textarea {
width: 100%;
border-width: 1px;
border-style: solid;
border-right-color: #dbdfe6;
border-bottom-color: #e3e9ef;
border-left-color: #e7e8ed;
border-top-color: #abadb3;
z-index: 2;
}
.no-contact-info span {
display: block;
background:#FFFFC6 url(/media/icons/error.png) no-repeat 4px center;
padding: 2px 0 1px 24px;
color: #333333;
font-size: 12px;
font-weight: bold;
border: 1px solid #abadb3;
border-top-color: red;
width: 200px;
margin-top: -3px;
z-index: 1;
-webkit-border-bottom-right-radius: 4px;
-webkit-border-bottom-left-radius: 4px;
-moz-border-radius-bottomright: 4px;
-moz-border-radius-bottomleft: 4px;
border-bottom-right-radius: 4px;
}
view: http://jsfiddle.net/XurSz/
I want to push the "no contact info" span up slightly so that it covers the bottom border of the textarea... but the textarea keeps wanting to go overtop. How can I get around this?
The z-index property only affects elements that have been positioned. Adding position:relative; to the textarea and the span should do the trick.