I have a float right div within a template that loads correctly on initial page load or hard refresh.
However, on state change (using ui-router) then returning (ie swapping templates out), div gets bumped down, by what looks like a div to its left with no float.
Have I applied CSS incorrectly somehow?
Screen shots attached of both scenarios. First image is initial load, second is the page (NG template) returned after leaving via link on page. Link is a template too. The only reason I mention NG is that I've tried to recreate in Plunker with conventional href links, and failed to get the error.
HTML
<div class="locate-change">
<input type="text" color="red" placeholder="ENTER LOCATION" class="input1" />
<a ng-click="locateme()" href="" class="locate2">LOCATE</a>
</div>
CSS
.locate-change {
float:right;
height: 35px;
padding-left: 10px;
width: 300px;
}
.input1 {
display:inline-block;
border: 1px solid red;
background: #000000;
text-transform: uppercase;
font-family:'DINLightRegular', Helvetica, Arial, sans-serif;
font-size: 1em;
margin: 0;
padding: 4px;
outline: none;
width:160px;
}
.locate2 {
float: right;
padding-left:35px;
background: url(../../images/locate.png);
height: 30px;
background-size: cover;
background-size: 30px;
background-repeat:no-repeat;
width:65px;
}
I can recreate the angularjs plunker if necessary.
EDIT a couple of notes:
- this is only happening in Chrome, not in FF or Safari
- the 'Change City' input div uses Angular UI Bootstrap typeahead which seems to add a .dropdown-menu class div - but it has zero dimensions (see screenshot below)
- the empty typeahead dropdown results div code appears and is identical in both correct and incorrect states
I think this is a bug in how Chrome treats the angular-ui bootstrap typeahead directive (based on the fact that we're not seeing this error in either FF or Safari)
The order things are happening seems to be:
- on initial load, the DOM only loads existing html/CSS elements
- once the DOM is loaded, the ng directive then adds the empty typeahead dropdown div, which sits 'below' the locate2 div on the screen despite being written in the DOM between existing divs
ie as the browser reads through the DOM it places:
- input div 1st
- locate2 div 2nd
- invisible dropdown div added last via directive
On returning to the page via ui-router:
- the DOM now includes the additional dropdown element between input and locate2 divs
- each html element is treated in the order it's read in the DOM
- this means that the 'invisible' dropdown div now pushes the locate div out of the way...(in Chrome)
ie as the browser reads through the DOM on returning to the template it places:
- input div 1st
- invisible dropdown div 2nd
- locate2 div 3rd
For whatever reason, Chrome is treating the dropdown not as a hidden div, but as a collapsed visible(?) div and pushing the locate2 div out of place.
On moving the locate2 div to before the change-city div, the injected dropdown code no longer interferes with locate2 div.
In the 'fix', as the browser reads through the DOM it places:
- locate2 div 1st
- input div 2nd
- invisible dropdown div 3rd
Related
I am using Elementor page builder. I mention this because it allows css to be placed in the widget itself.
I have two versions of a div table, one for PC and Tablet and another for Mobile only. They are co-existing on the same page but have display options set in each section.
Two days ago I gave the mobile version an extra class name of "scroll-table" and applied this css snippet to it;
table.scroll-table {
display: block;
overflow-x: auto;
white-space: nowrap;
}
The table scrolled horizontally quite nicely on Firefox mobile browser and well enough on Chrome mobile browser (client viewed on this browser). It was a very long day so I called it quits.
Yesterday I added some more css to place a button where the signup links were (final right hand column). I did this by adding the class name "button" to the links, "btn" seemed to be pre-existing because it immediately shrunk the text. Then I added this css snippet in both widgets (Mobile and PC).
.button {
display: inline-block;
padding: 12px 24px;
border-radius: 6px;
border: 0;
font-weight: bold;
letter-spacing: 0.0625em;
text-transform: uppercase;
background: #F39C25;
color: #fff;
}
The result was that the buttons appeared, and correctly, however it stopped horizontal scrolling on the Firefox mobile browser, while the Chrome mobile browser scrolls the whole page horizontally. This behavior on Chrome mobile is acceptable to the client but I am not thrilled with it. The day before, when it was working on Firefox mobile it scrolled as a container complete with a scroll-bar underneath. Being tired (and a little under the weather) I assumed this is what the client was seeing as well.
Adding !important to the overflow-x: auto; has no effect so I removed it again.
I have no problem adding css to the style.css if that would help, and have a Child theme installed. However, in the Elementor FB group there has been much ado about "You don't need a child theme." and thought in this case the widgets would be a more appropriate place to place it.
Can anyone help?
I need to do school work. I need to link the button and put it to the right side of my page but every time i put the link or button to the right it does not work.
What html code should I put and in what order to have button on the right and link to it. On the photo is what I have right now.
This is a simple thing - as noted above - you need to float it to the right.... BUT if you are floating something - this will have consequences on the next elements - so you will also need to clear the float.
Another thing to think of - is that a p element is a block level element - so will take up the entire row - whereas an a element is an inline level element - meaning it won't. This is why doing it this way causes the button to be on the previous line up from the p - which is on the next row. You can alter that - but it needs to be planned out a bit.
Just so you understand the structure of the HTML - this may also allow you to have a different structure to the code. Also - I only put in the text that showed up in the image so it is not a full row.
Also note that I have applied the CSS to the element in the CSS portion as opposed to inline styling - this is better code structure as it keeps the HTML and CSS separate. I also whacked in some styling (from https://www.thoughtco.com/styling-links-with-css-3466838) to give link a button like look.
.button{
float:right;
border-style: solid;
border-width : 1px 4px 4px 1px;
text-decoration : none;
padding : 4px;
color:black;
border-color : #69f #00f #00f #69f;
}
.button:hover {
border-color: black;
color: #00f ;
}
p{
clear:both
}
<a class="button" href="2.html">Next</a>
<p>The most important reason of why you should remain heal</p>
If you put this html code element in:
<button>this page
You will get this:
<button>this page
</button>
And this to your CSS:
button {
float: right;
}
You will get at end this:
<style>button {
float: right;
}
</style>
<button>this page
</button>
You have to add a little bit of CSS.
<button style="float:right;">
On the following page, http://duncanmorley.com/ there are the following issues:
One cannot highlight text within the document
When a user hovers over an object with the ":hover" property applied,in the CSS file, the hover effect doesn't happen (See social icons at the top) (class="fb")
It seems that there is a transparent object over the page which is not allowing the user to interact with the elements. I'm unsure what this is, as there is nothing in the CSS file (that I can see) that suggests this is the issue.
I believe these issues are likely the result of one problem.
text-indent: -99999999px; causes the issue here because it will modify the area hover works, too.
Fix for the Facebook share button (an example)
Remove the text-indent style from the fb class and change <li class="fb">Facebook</li> to <li class="fb"><span class="hide">Facebook</span></li>
Now you can style the text the sr-only way:
.hide {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0,0,0,0);
border: 0;
}
At the end you should get the same effect, the "Facebook" text will be hidden for the visual presence and the hover effect will work on the entire element.
Oddly enough, your text-indent is too large. If you make it -9999999px instead, Chrome seems to like it better.
In my GWT application I have a button panel, implemented as HorizontalPanel containing Button widgets wrapped within <g:cell> elements.
<g:HorizontalPanel styleName="{style.horizontalPanel}">
<g:cell>
<g:Button ui:field="selectButton" title="{constants.buttonLabel}"
text="{constants.actionLabelSelect}" />
</g:cell>
...
</g:HorizontalPanel>
The buttons have the following css:
.gwt-Button {
font-size: 13px;
color: #337BB1;
margin: 0px 10px;
padding: 5px 7px;
border: 1px solid #E3E3E3;
}
Button labels often have two words. Compared to all non-IE browsers, the button panel does not fit into the layout. Each button looks way too wide, a certain button is only shown partly. Moreover, even if I resize the view (Ctrl + "-"), this still is the case, as the whole panel containing the buttons is resized. The behavior of all FF and Chrome is: button labels are line-breaked if the panel does not fit into the browser window, and the buttons are much smaller by default, so that it cleary fits in standard browser size.
Why is IE behaving differently?
Another problem with debugging is that in GWT's superDevMode and devMode, the problem does not occur in IE, too.
How is this possible?
Browser version: IE8,
GWT version 2.5.1
Try with CSS min-width Property
.gwt-Button {
...
min-width: 135px;
}
you can try with CSS overflow Property also
overflow: visible;
I have a simple button (as shown below) on which I need to display two pictures, one on either side of the button text. Im battling to create the CSS that will work in both Firefox and Internet Explorer! (the button images are coming from a JQuery UI skin file)
CSS
button div{
width:16px;
height:16px;
background-image: url(images/ui-icons_d19405_256x240.png);
}
button div.leftImage{
background-position: -96px -112px;
float: left;
}
button div.rightImage{
background-position: -64px -16px;
float: right;
}
HTML
<button><div class="leftImage"></div><span>Button Text</span><div class="rightImage"></div></button>
Preview
Firefox
Internet Explorer 8
Here is how to do it
The Theory
Block elements (like DIV) although displayed in order of creation, will position themselves adjacent to the previous element or when short of space, on the next line. Because we dont want to give the button a width (we want the button to be automatically sized based on the content of the button) the block elements continued to appear on the next line (see IE8 image in the question above). Using white-space:nowrap forces inline elements (like SPAN and EM) to be displayed on the same line, but is ignored by block elements, hence the solution below.
CSS
button{
margin: 0px;
padding: 0px;
font-family:Lucida Sans MS, Tahoma;
font-size: 12px;
color: #000;
white-space:nowrap;
width:auto;
overflow:visible;
height:28px;
}
button em{
vertical-align:middle;
margin:0 2px;
display:inline-block;
width:16px;
height:16px;
background-image: url(images/ui-icons_3d3d3d_256x240.png);
}
button em.leftImage{
background-position: -96px -112px;
}
button em.rightImage{
background-position: -64px -16px;
}
HTML
<button><em class="leftImage"></em>Button<em class='rightImage'></em></button>
The Result
Internet Explorer 6, 7, 8 and Firefox 1.5, 2, 3
I would use spans not divs for the image containers, since you seem to want the images to appear inline. Using floated divs is just too complex.
In fact, you could probably simplify things further by applying one background image to the button itself, and one to the button-text span, and removing the other two containers altogether.
Another alternative is to simply add the images in as img tags.
try resetting the button css.
button{
border:none;
background:none;
padding:0;
margin:0;
}
And add a space inside an empty DIV see if it works.
<button><div class="leftPic"> </div><span>Button Text</span><div class="rightPic"> </div></button>
I think you can strip off the button tag and use a div tag instead.For other button action use javascript onlick() function and use css to change curser on hover(to make it look like button).For my project I used a similar approach.This may help you :)
I know this is already solved, but just wanted to add that an easy way to put more than 1 image in a button is creating 1 .png with the dimensions of the button you want to create and the to elements together in one file.