I have implemented a facebook style search suggestion feature for my application . But , I am facing some issues here .
i) Below is the search box and the result div code :
<div align="right" style=" width:300px; float:right; margin-right:30px">
<input type="text" id="searchbox" class="searchbox" maxlength="100" style="color: rgb(170, 170, 170);"> <img src="../../../asset/images/search.png" style="margin:0 0 -5px 2px"><br><br>
<input type="hidden" value="http://www.plus-one-me.com/search/google/interests" id="formurl" name="formUrl">
<div id="display">
</div>
</div>
The search results get displayed within the #display div as below:
<div id="display" style="display: block;">
<div class="display_box" align="left"> Cakephp </div>
<div class="display_box" align="left"> Myspace </div>
<div class="display_box" align="left"> Php </div>
</div>
This is how the page looks before we enter anything in the search area :
Below is what the search results div is doing :
Basically , it brings down the menu in my main content area . So how can I fix this using CSS ?
Below are the styles :
of the menu div in the background (containing the options Home,History and Settings
.menuBar .submenu {
padding:4px 12px 5px 12px;
margin-right:8px;
border:2px solid #EEE;
text-decoration:none;
display:inline-block;
float:left;
font-size:13px;
-moz-border-radius:40px;
border-radius:40px;
-webkit-border-radius:40px;
-moz-box-shadow:0 1px 3px #777;
-webkit-box-shadow:0 2px 3px #777;
box-shadow:0 2px 3px #777;
color:#333;
background: -webkit-gradient(linear, 0 0, 0 70%, from(#765), to(#FFF));
background: -webkit-linear-gradient(#000, #FFF 70%);
background: -moz-linear-gradient(#BBB, #FFF 100%);
background: -ms-linear-gradient(#765, #FFF 70%);
background: -o-linear-gradient(#765, #FFF 1000%);
background: linear-gradient(#765, #FFF 70%);
-pie-background: linear-gradient(#765, #FFF 70%);
}
of my searchbox :
#searchbox {
border: 1px solid #000000;
padding: 3px;
width: 250px;
}
and the display_box for individual results :
.display_box {
border-top: 1px solid #DEDEDE;
font-size: 12px;
height: 30px;
padding: 4px;
}
the drop down menu has to have position:absolute applied to it. This takes it out of the flow of the page so it doesn't affect other elements.
As #Galen suggested, try css:
#display {
position: absolute;
}
You might want to instead have the html thats outputed be something more like
<ul id="display">
<li>result</li>
<li>result</li>
<li>result</li>
</ul>
Which if you did, you would have css along the lines of
#display {
position: absolute;
list-style-type: none; list-style: none;
margin: 0; padding: 0;
}
#display li {
display: block;
border-top: 1px solid #DEDEDE;
font-size: 12px;
height: 30px;
padding: 4px;
}
Related
I've been trying to make a gradient top border for a box with a radius. The gradient border should only be at the top of the box, and it needs to have the same radius (5px) as the rest of the box. The end result should look like this:
My current code:
.card {
text-align: center;
margin: 0 1%;
background-color: #252a41;
border-radius: 5px;
border: none;
width: 25%;
padding: 3% 0;
}
.instagram {
border-top: 3px solid rgb(243, 242, 241);
border-radius: 5px;
border-image: linear-gradient(to right, #fdc468, #ffa263, #ff806c, #f9607f, #df4996) 1 / 3px 0px 0px 0px / 0px 0px 0px 0px round;
position: relative;
}
<div class="card instagram">
<div class="row">
<img src="images/icon-instagram.svg" alt="instagram icon" />
<span class="small-text username">#realnathanf</span>
</div>
<h1 class="followers-count">11k</h1>
<p class="small-text followers">FOLLOWERS</p>
<div class="row">
<img src="images/icon-up.svg" alt="icon up" />
<span class="change change-up">1099 Today</span>
</div>
</div>
Apparently the border-image property isn't compatible with border radius, so I have to make a before/after pseudo-element. However I couldn't figure out how to make one for the desired result.
You can do it with only background:
.box {
width:200px;
height:200px;
border-radius:5px;
background:
linear-gradient(to right, #fdc468, #ffa263, #ff806c, #f9607f, #df4996) top/100% 5px no-repeat,
#000;
}
<div class="box">
</div>
I am trying to build a website that uses the Twitch API and posts which users, from a predetermined array of 7 users, are online and which are not. It pretty much works, but at the moment, the edges of my top div are not lining up with the edges for my list of users.
Here's a link to the codepen: https://codepen.io/lieberscott/pen/YVZQMG
And here's some of my code.
HTML:
<div class="container-fluid">
<div class="row">
<div class="col-xs-3">
</div>
<div class="col-xs-6 head">
<span class="title">
Twitch Streamers
</span>
<table>
<tr>
<td id="all">ALL</td>
</tr>
<tr>
<td id="online">ONL</td>
</tr>
<tr>
<td id="offline">OFF</td>
</tr>
</table>
</div>
</div>
</div>
<div id="result">
</div>
</div>
CSS
$blue: #5D6E81;
$gray: #68636B;
$khaki: #B7D0B9;
$title: #F1EBF2;
img {
border-color: white;
border-radius: 50%;
border-style: solid;
border-width: 3px;
height: 50px;
margin-right: 25px;
width: 50px;
}
line {
background-color: $title;
height: 5px;
}
table {
float: right;
font-size: 10px;
margin-right: 6px;
}
.act {
background-color: $khaki;
margin: 1px 0px 1px 0px;
padding: 8px 8px 8px 15px;
}
.desc {
color: $gray;
padding-top: 20px;
}
.desc2 {
color: $title;
}
.head {
background-color: $gray;
color: $title;
font-size: 40px;
overflow: hidden;
padding: 15px 0px 10px 25px;
}
.inact {
background-color: $blue;
margin: 1px 0px 1px 0px;
padding: 8px 8px 8px 15px;
}
.inact a, inact a:hover {
color: $khaki;
}
.title {
font-family: 'Days One', sans-serif;
font-size: 40px;
}
Is there anything I can do with this existing code to make sure the width of the top div is aligned with the results? Or do I need to rework it?
(As a note, I did have it aligned with previous code using a single row and putting each result in a "col-xs-6 col-xs-offset-3" class, but this created another problem which was I couldn't make each result's img, user name, and status be vertically aligned with each other, which I would prefer.)
You accidentally closed your .container before the results. Remove the </div> immediately above the #results wrapper, paste it further down, and it all lines up: https://codepen.io/mayersdesign/pen/GmWyWy
I have a bootstrap button for a standard bootstrap dropdown. I am styling it a lot to basically remove any color and make it transparent at all times. But when I click it, it has a grey inner shadow. I would like to remove it.
Here is my CSS:
.input-control {
height: 5rem;
width: 49%;
display: inline-flex;
background-color: transparent;
border-top-style: none;
border-right-style: none;
border-bottom: 1px solid dimgray;
border-left-style: none;
-moz-box-shadow: none;
-webkit-box-shadow: none;
box-shadow: none;
border-radius: 0;
}
button.input-control:hover {
background-color: none;
background: none;
}
.btn-primary.active, .btn-primary:active, .open>.dropdown-toggle.btn-primary {
/* color: #fff; */
background-color: transparent;
border-color: transparent;
}
.btn:focus,.btn:active {
outline: none !important;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
color: #fff;
background-color: transparent;
border-color: dimgray;
}
.btn-primary.active.focus, .btn-primary.active:focus, .btn-primary.active:hover, .btn-primary:active.focus, .btn-primary:active:focus, .btn-primary:active:hover, .open>.dropdown-toggle.btn-primary.focus, .open>.dropdown-toggle.btn-primary:focus, .open>.dropdown-toggle.btn-primary:hover {
color: #fff;
background-color: transparent;
border-color: dimgray;
}
.btn-primary:hover {
color: #fff;
background-color: transparent;
border-color: dimgray;
}
dropdown > button {
background:none;
border:none;
box-shadow:none;
}
.form-background {
background: rgba(149, 246, 102, .5);
}
#find-vegan-products-page {
margin-top: 100px; /*separate the div from top of the page*/
padding: 100px; /*or whatever value to give the div space */
}
HTML:
<div id="find-vegan-products-page" style="height:900px;">
<div class="form-background">
<form role="form" style="padding: 40px;">
<div class="form-group">
<div class="dropdown">
<button class="btn btn-primary dropdown-toggle input-control no-box-shadow" type="button" data-toggle="dropdown">Dropdown Example
<span class="caret"></span></button>
<ul class="dropdown-menu">
<li>HTML</li>
<li>CSS</li>
<li>JavaScript</li>
</ul>
</div>
</div>
<div class="form-group">
<input type="text" class="form-control input-control no-box-shadow" placeholder="City">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
</div>
</div>
Example of the look of the dropdown:
How do I make the inner shadow go away?
EDIT: It looks a bit like an inner box-shadow that is showing in grey so the blue outline has probably fully gone away and now I need to remove the grey inner box shadow.
The answer was not too hard once I figured out it was not the blue outline staying anymore and it was now a grey box shadow.
I just had to add: box-shadow: none; to:
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
color: #fff;
background-color: transparent;
border-color: dimgray;
box-shadow: none;
}
Try this CSS code:
CSS
:focus {
outline: 0 !important;
}
Now you will never see it again. However, it is maybe not a good idea to remove it entirely.. Users who access your site and using their keyboard to 'walk' through your site never see where they are going. See this blog.
.btn.btn-default:focus {
border:none;
outline:0;
}
The code below displays some text (#_EVENTEXCERPT) and displays a picture (#_EVENTIMAGE). I want it so the text is on the left and the image on the right, so they are next to each other, as this code does. Below this there is a <a href="#_EVENTURL with lots of css which makes this link into an orange button. Currently, this orange button is being moved right with the image. I don't want this to happen, how can I move the image next to the text (as is currently), but leave the <a href to the left?
from style sheet:
#eventexcandimage {
width: 100%;
}
from .php file:
<div id="eventexcandimage">
<span style="width: 50%; float: left; "> #_EVENTEXCERPT </span>
#_EVENTIMAGE </div>
</li>
<li>
<span style="width:50%; " > <a href="#_EVENTURL" style=" -moz-box-shadow:inset 0px 1px 0px 0px #ed834e;
-webkit-box-shadow:inset 0px 1px 0px 0px #ed834e;
box-shadow:inset 0px 1px 0px 0px #ed834e;
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ed834e), color-stop(1, #ed834e) );
background:-moz-linear-gradient( center top, #ed834e 5%, #ed834e 100% );
background-color:#ed834e;
-webkit-border-top-left-radius:0px;
-moz-border-radius-topleft:0px;
border-top-left-radius:0px;
-webkit-border-top-right-radius:0px;
-moz-border-radius-topright:0px;
border-top-right-radius:0px;
-webkit-border-bottom-right-radius:0px;
-moz-border-radius-bottomright:0px;
border-bottom-right-radius:0px;
-webkit-border-bottom-left-radius:0px;
-moz-border-radius-bottomleft:0px;
border-bottom-left-radius:0px;
text-indent:0px;
display:inline-block;
color:#fffffb;
font-family:Arial;
font-size:13px;
font-weight:bold;
font-style:normal;
height:35px;
line-height:35px;
width:111px;
text-decoration:none;
text-align:center;
text-shadow:1px 1px 0px #ed834e;
"> More Info / Book</a> </span>
Thank-you!
UPDATE: YI want the button to be on a new line below the text/image. It is currently above the image on the right, I don't know why.
Okay so I took your code and hopefully made it work the way you wanted it to(?)..Maybe.
Also just below your code I rewrote it not using span or li but rather div's as they're better for positioning than the former two. Here is link to the Fiddle as well it attached as a snippet.
.btn {
-moz-box-shadow:inset 0px 1px 0px 0px #ed834e;
-webkit-box-shadow:inset 0px 1px 0px 0px #ed834e;
box-shadow:inset 0px 1px 0px 0px #ed834e;
background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ed834e), color-stop(1, #ed834e) );
background:-moz-linear-gradient( center top, #ed834e 5%, #ed834e 100% );
background-color:#ed834e;
-webkit-border-top-left-radius:0px;
-moz-border-radius-topleft:0px;
border-top-left-radius:0px;
-webkit-border-top-right-radius:0px;
-moz-border-radius-topright:0px;
border-top-right-radius:0px;
-webkit-border-bottom-right-radius:0px;
-moz-border-radius-bottomright:0px;
border-bottom-right-radius:0px;
-webkit-border-bottom-left-radius:0px;
-moz-border-radius-bottomleft:0px;
border-bottom-left-radius:0px;
text-indent:0px;
display:inline-block;
color:#fffffb;
font-family:Arial;
font-size:13px;
font-weight:bold;
font-style:normal;
height:35px;
line-height:35px;
width:111px;
text-decoration:none;
text-align:center;
text-shadow:1px 1px 0px #ed834e;
}
.event {
width: 100%;
margin-top: 25px;
}
.event_info {
width: 100%;
margin-bottom: 5px;
}
.event-text {
float: left;
width: 50%;
}
.event-text > h3 {
margin: 0;
padding: 0;
}
.event-img {
width: 50%;
float: left;
}
.img {
width: 100%;
height: 125px;
background: red;
display: block;
}
<ul>
<li>
<div id="eventexcandimage">
<span style="width: 50%; float: left; ">
#_EVENTEXCERPT
</span>
<div style="width: 50%; float: left;">
<img class="img" src="" />
</div>
</div>
</li>
<li style="clear: both;"> <span style="width:50%; "> More Info / Book </span>
</li>
</ul>
<div class="event">
<div class="event-info">
<div class="event-text">
<h3>Event Title</h3>
<p>Text about your event</p>
</div>
<div class="event-img">
<img class="img" src="" />
</div>
</div> <!-- End event-info -->
<div style="clear: both;">
More Info / Book
</div>
</div>
I'm going to assume that your provided HTML has been cut off because some of your tags are not properly opened nor closed, but that's irrelevant as to why you're seeing the behavior you are.
span by default is displayed inline (everything naturally flowing on a line). You have your button in a span which means it's trying to stay on the same line as the things before it, which is doing what you're seeing. So what can you do? Well, the quickest fix is to make this button start on a new line. Change the display on the button to display:block. Block level elements take up the entire width, which will force a line break since something that is full width can't share the line with other things.
I want to be able to line up the labels correctly in columns, so that varying length/type input fields always line up. The labels are always formatted to the same length.
Also, I could do with being able to omit rows in come of the columns if required. I've achieved this by having a within the cols div.
What I've done works; however, it 'feels' as though it's a fudge, and I think there should be better ways of achieving this.
Cheers.
<div id="divAddInputFields">
<fieldset id="fsAddInputFields" class="inputFieldSet">
<div id="divFsAddCol1">
<div id="divFsAddCol1Row1">
<label id="lblGenCode" for="wsGenCode">Gen Code</label><input type="text" class="String02" name="wsGenCode" id="wsGenCode" />
</div>
<div id="divFsAddCol1Row2">
<label id="lblRelNote" for="wsRelNote">Rel Note</label><input type="text" class="String12" name="wsRelNote" id="wsRelNote" />
</div>
<div id="divFsAddCol1Row3">
<label id="lblQuantity" for="wsQuantity">Quantity</label><input type="text" class="Number7_0" name="wsQuantity" id="wsQuantity" />
</div>
</div>
<div id="divFsAddCol1Row1">
</div>
<div id="divFsAddCol2">
<div id="divFsAddCol2Row1">
<label id="lblCofC" for="wsCofC">C of C</label><input type="text" class="String12" name="wsCofC" id="wsCofC" />
</div>
<div id="divFsAddCol2Row2">
<label id="lblComp" for="wsComp">Comp</label><input type="checkbox" class="checkbox1" name="wsComp" id="wsComp" />
</div>
</div>
</fieldset>
</div>
Page specific css (in an external file.....).
#divAddInputFields {width:460px; margin:0px 0px 0px 0px; height:160px; overflow:auto; float:left; }
#divFsAddCol1 {width:220px; margin:0px 0px 0px 0px; height:140px; overflow:auto; float:left; }
#divFsAddCol2 {width:220px; margin:0px 0px 0px 0px; height:140px; overflow:auto; float:left; }
Css from a library
.inputFieldSet
{ padding:0px 0px 0px 0px;
border:none;}
.label, .inputFieldSet label {
height:15px;
width:80px;
display: inline-block;
border:1px solid black;
padding:1px 2px 1px 2px;
background-color:#66cdaa;
vertical-align:top;
text-align:left;
margin:0px 1px 1px 3px;
font-size:10px;
}
.inputFieldSet input {
height:15px;
padding:1px 2px 1px 2px;
border:1px solid grey;
vertical-align:top;
position: relative;
/*overflow: hidden;*/
margin:0px 0px 1px 0px;
}
.inputFieldSet input[type="submit"] {
padding:1px 2px 1px 2px;
vertical-align:top;
height:20px;
position: relative;
/*overflow: hidden;*/
margin:0px 0px 1px 0px;
}
.inputFieldSet input[type="checkbox"] {
padding:1px 2px 1px 2px;
vertical-align: top;
margin: 0px 0px 0px 0px;
}
.inputFieldSet select {
padding:1px 0px 1px 2px;
vertical-align: top;
position: relative;
/*overflow: hidden;*/
margin:0px 0px 1px 0px;
}
I would use a <table> for this if you can.
Tables are intended for displaying tabular data like this.
They (correctly) got a bad rap for being used for doing HTML design layout.
But for tablular data like this I would use one.
You'll obviously be able to take care of alignment issues much easier.