I have a css problem with my drupal site (www.terrafirmasouth.co.uk) to do with the slideshow caption box and the pager block underneath.
When you access my site for the first time, the transparent caption box (bottom left) on the slideshow starts lower by the height of the pager block below then adjusts itself to the correct position. Pressing Ctrl-F5 also recreates the problem.
If I disable the pager block the problem goes away.
By adding position:absolute to the pager block the jumping stops, but the text below my pager block seems to interfere (overlap?) with my pager block, and I cant click on the numbers anymore to change slide .
I want to be able to show the pagers (1-6) under the slide, so that they can be clicked (I have already tested this with no position:absolute and it works fine, but I have the jumping problem of course).
I have attached my latest css below, but this has not gone live onto my site yet, just running it on my pc using xammp.
/* my caption box */
.trcaption {
position: absolute;
left: 20px;
bottom: 10px;
background: #353535;
opacity: 0.85;
filter:alpha(opacity=85);
color: #FFFFFF;
padding: 10px 10px 10px 10px;
}
/* title inside caption box */
#trtitle {
font-weight: normal;
font-size: 18px;
padding-bottom: 5px;
color: #FFFFFF;
font-family: 'LatoLight', Arial, sans-serif;
}
/* read more link inside caption box */
#trlink a {
color: #008C07;
float: left;
font-size : 12px;
}
/* pager block under my slideshow */
.views-slideshow-controls-bottom {
display: block;
position: absolute;
text-align:center;
width: 100%;
}
/* pager item i.e. number number */
.views-slideshow-pager-field-item {
display: inline-block;
margin-right: 20px;
padding-left: 10px;
padding-right: 10px;
margin-top: 5px;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
/* show active pager with grey background */
.views-slideshow-pager-field-item.active {
background: #E8E8E8;
}
If you are adding something absolute, make sure nothing else with property absolute is clashing with same, you can use z-index to arrange them in layer.
that will stop the clashing and things should work fine then. :)
For more help please add some working code, apart from CSS or create fiddel on jsfiddle
Related
I've been trying to style my search box the way I want it and it's very nearly there. The only problem is that my widths are wonky somewhere. They look OK on initial glance but the area of the input box leaks into the submit button. This is most visible on mobile where my border-right: none; is ignored and a rounded border overlaps the button. It's also evident on Chrome where a suggestions dropdown overhangs the button.
iPhone view
Area of input box leaks into button
The search box is generated by Search API Pages module on Drupal 9. You can see it in action here https://verygomez.com/search where it appears in both the sidebar block and on the page. I need them both to look good but they share most of the CSS. I'm at a bit of a loss. Incidentally, I'd ideally like the search bar in the sidebar to be a bit wider but I can't figure out how to do that.
.search-api-page-block-form-search {
position:relative;
width:100%;
display:inline-block;
}
.search-api-page-block-form-search .form-item {
width: 70%;
float: left;
}
.search-api-page-block-form-search .form-actions {
width: 30%;
float: right;
}
.search-api-page-block-form-search .form-type-search input {
border-right: none !important;
text-indent: 25px;
background-color: transparent;
position: absolute;
display: inline-block;
width: 66%;
}
.search-api-page-block-form-search .form-type-search:before {
content: "\f002";
font-family: FontAwesome;
position: relative;
top: 8px;
left: 25px;
background-color: transparent;
}
.search-api-page-block-form-search .form-item,
.search-api-page-block-form-search .form-actions {
margin: 5px auto!important;
display: inline-block;
font-family: Consolas, "courier new";
}
.search-api-page-block-form-search .form-actions input {
font-family: FontAwesome;
margin: 0 !important;
}
.path-search form.search-form>.form-wrapper>.form-submit{
position:relative;
right:0;
bottom:0;
margin:0 !important;
width:100%;
}
Edit
I have a progress update. Changing the position from absolute to relative here:
.search-api-page-block-form-search .form-type-search input {
border-right: none !important;
text-indent: 25px;
background-color: transparent;
position: relative;
display: inline-block;
bottom: 25px;
}
has corrected the input box to the correct width enabling me to scrap the 66%. This could solve my problem but now the boxes are no longer aligned horizontally. I tried to fudge it with a bottom but of course it isn't close enough. I just have a different problem to solve. (I have however managed to make the sidebar search box wider so it's not all bad).
Edit 2
Final progress update of the evening. I have now exchanged that issue for yet another one. Changing the fontawesome background image to position: absolute; (as it also is in the code of the default search box that I'm copying from), the box and button are now perfectly aligned and the widths look good.
However, with an absolute setting the search icon is now in a different position in the sidebar than in the page and it changes according to screen size so it's also out of alignment on mobile. Is there a way to make it just sit neatly in the search box? I feel like I'm missing something.
.search-api-page-block-form-search .form-type-search:before {
content: "\f002";
font-family: FontAwesome;
position: absolute;
top: 42px;
left: 34px;
background-color: transparent;
}
I've done it!!! After I'd made the changes described in my edits above, I was just missing this little beast!
.search-api-page-block-form-search .form-type-search {
position: relative;
}
open the following URL in chrome
www.nextag.com/camera/stores-html
and refresh the page
Notice the location of the help icon next to ZIP code on top right corner..it is misaligned
Now open the same in firefox.. it is properly aligned..
CSS code for this is as follows:
background: none repeat scroll 0 0 white;
border: 1px solid #C2CCCC;
border-radius: 4px 4px 4px 4px;
color: #C2CCCC;
display: block;
float: right;
font-weight: bold;
height: 13px;
margin-left: 4px;
text-align: center;
width: 12px;
padding-right: 1px;
to make it work in firefox.. i added the following 3 ATTRIBUTES:
position: relative;
top: -15px;
left: 18px;
then it started working fine in chrome, but now it got misaligned in firefox.. what do i do??
You have a SPAN inside A. Simply disable the "float: right" property and add "display: inline"
.rb span.zip-info {
dispay: inline;
float: none;
}
Have you tried using the "position: absolute" attribute instead of "position: relative"?
Seems like Firefox has an invisible padding or margin that places the element at the top right of the text space. Chrome is placing the element at the top right of the fieldset element outside of the flow of text.
You can do one thing add a div wrapper and then absolutely position the element in the top right of the wrapper.
Hope this helps.
Add property float:left
.rb #zipTxt a {
color: #2283AB;
font-size: 12px;
font-weight: bold;
float: left;
}
What seemed like an easy task has become hours of puzzling by now.
I have a dropdownlist (#html.dropdownlistfor(model)), which I style via css ( new { #class = "searchDropDownList" } )
The thing is, the standard dropdown list is too short (height-wise), but when I add height to make the box bigger, the selected item is not centered anymore. vertical-align: middle doesnt work on the selected item.
When I add padding to the top of the box, the text goes down as I want, but when you would then hover the textbox, you can see the Selection Arrow being croocked, since that ones also goes down.
See pictures:
Firefox:
Chrome:
Does anyone know how to lower only the text?
EDIT:
Current css:
.searchDropDownList {
display: inline;
width: 114px;
height: 26px;
float: left;
font-size: 14px;
margin: 4px auto auto 2px;
text-align: left;
vertical-align: middle;
padding-left: 2px;
padding-top: auto;
line-height: 10px;
}
Changing the padding-top: auto; to 3px results in the images posted above.
I have a question regarding some CSS that I'm sure has a simple solution, but just not obvious enough for me to find it yet.
I have a div defined in my HTML file with a background image, which I set in my CSS file. I then set a hover state for the div using CSS so that the background image would change on mouse over. I then placed text on top of the div in my HTML file, to make a button with text on it.
Here is where I run into my problem, however - when I mouse over the image (background image of the div), the image changes, but when my cursor hits the text on top of it, the hover state changes back to the regular one, changing the background image as well, while the text doesn't change. When I move the cursor away from the text, it changes back to the hover state.
I have the code set up in a JSFiddle at http://jsfiddle.net/Cwca22/jk7ty/ - any help would be greatly appreciated! Thanks in advance!
You can really simplify your code.
HTML
<a class="button" href="directions.html">Get Directions</a>
CSS
a.button {
background: url('http://f.cl.ly/items/0G0b0m1k0A1T2c3D102H/get-directions-button.png') no-repeat;
color: white;
display: block;
font-family: Ovo, serif;
font-size: 18px;
height: 42px;
line-height: 42px;
text-align: center;
width: 135px;
}
a.button:hover {
background-image: url('http://f.cl.ly/items/0U1O3P1F2h312W0j3k1Z/get-directions-button-hover.png');
color: #fff;
}
:hover only applies when you are hovering over that element or one of it's children. You created the button with one element, and then created the text and used CSS trickery to position it over the button. As soon as you hover over the text, the browser thinks you're no longer hovering over the button, and drops the new background.
Also, styles cascade. So in the rules for :hover, you need only specify the attributes that have changed. (In this case, background and color.)
fiddle: http://jsfiddle.net/jk7ty/10/
Move the Get Directions link inside the main div. You'll need to do some formatting for it but this should get you pretty close.
<a href="directions.html">
<div id="getDirections" class="getDirections" style="margin-top: 10px; margin-left: 131px;">
<h3 class="getDirectionsText" style="margin-left: 154px; margin-top: -28px; font-size: 14px; font-weight: 300;">Get Directions</h3>
</div>
</a>
I rewrote and simplified it for you and it works now:
Here's the link:
Get Directions
Here's the CSS:
a.getDirections {
display: block;
background: url('http://f.cl.ly/items/0G0b0m1k0A1T2c3D102H/get-directions-button.png') no-repeat top left;
width: 135px;
height: 30px;
font-family: Ovo, serif;
font-size: 15px;
color: white;
text-align: center;
text-decoration: none;
padding: 12px 0 0 0;
}
a.getDirections:hover {
background: url('http://f.cl.ly/items/0U1O3P1F2h312W0j3k1Z/get-directions-button- hover.png') no-repeat top left;
}
A few things to note:
You can treat an A tag like a div if you give it a display: block; property
Since I put 12px padding on the top, I subtracted 12px from the height: property to leave only 30px (the button is actually 42px high)
I suggest reading about the "box model" (google it) to help out in future
You can also check it out on JSFiddle if you like:
http://jsfiddle.net/nerdburn/95ysC/
I would keep all of the HTML in the HTML section and the CSS in the CSS section. This just helps with keeping it all straight especially when you are testing.
This will give you a good result:
<div id="getDirections" class="getDirections"><h3 class="getDirectionsText">Get Directions</h3></div>
#getDirections {
display: table;
}
.getDirections {
background-image: url('http://f.cl.ly/items/0G0b0m1k0A1T2c3D102H/get-directions- button.png');
background-repeat: no-repeat;
width: 135px;
height: 42px;
cursor: pointer;
}
.getDirections:hover {
background-image: url('http://f.cl.ly/items/0U1O3P1F2h312W0j3k1Z/get-directions-button-hover.png');
background-repeat: no-repeat;
width: 135px;
height: 42px;
cursor: }
a{
text-decoration:none;
}
h3 {
font-family: Ovo, serif;
font-size: 18px;
color: white;
display:table-cell;
vertical-align: middle;
text-align: center;
}
If you use this code style you can make changes to your element sizes without having to rework the centering of the text.
here's an image of whats going on:
http://imageshack.us/photo/my-images/217/ffbug.png/
here's my code:
select {
width: 150px;
height: 40px;
padding-left: 10px;
}
in chrome and firefox, it vertically-aligns the select values perfectly. in firefox, the values are stuck to the top of the select.
i've tried adding vertical-align: middle and line-height: 40px, both of which changed nothing.
Just use padding-top: 10px; padding-bottom: 10px; on that element. Your text will be automatically centerd.
i decided to put it in a div with this code:
.search li select {
padding: 0px;
margin: 0px;
}
.search li div {
height: 32px;
padding: 10px 10px 0px 10px;
background: #ffffff;
}
the div background is same as the select background.
its pretty well centered in FF IE and chrome, only thing is the arrow is inside the padding as well...oh well...sometimes you can't win i guess.
Try this CSS code:
#-moz-document url-prefix() {
select {
padding-top: 13px;
}
}
This should work, when you want multiple browser support.