IE float workaround - css

http://www.ugiinc.com/products/
I am new to all of this so please bear with me.
I used float right on subpages-text and subpages-excerpt and clear on the excerpt to get it to sit right under the link, Works fine in other browsers but in IE the excerpt sits below the image, still on the right. Is this the ideal way of doing this? Is there something i can do to fix it for IE?
.subpages-row {
border-bottom: 4px solid black;
border-top: 4px solid black;
}
.subpages-cell {
width: 800px;
}
.subpages-text {
float:right;
}
.subpages-excerpt {
clear: both;
float: right;
width: 370px;
}

Try modifying your CSS like this (/**/ added on any lines that are new/different):
.subpages-text {
float:right;
width: 500px; /**/
text-align: right; /**/
}
.subpages-images-image {
float: left; /**/
}
.subpages-excerpt {
clear: none; /**/
float: right;
width: 370px;
}
The problem you were having was with clear: both; on .subpages-excerpt. If you get rid of that, the text jumps back up to the top. We also float the image left so it won't interfere with the text. Then, if you increase the width of the title so that the excerpt never fits on the top line, it will pop right under the title. Lastly, since we increased the width of the title, it needs text-align: right so that it still appears on the right side.

Related

How can I troubleshoot my CSS widths for my search box

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;
}

Floating image overlaps container. Clearfix hasn't worked

I have literally been trying every clearfix hack that I could find for hours and nothing is working. The paving photo at the bottom right always goes outside the content container. This is currently what I have:
.content {
margin: -10px auto 10px;
padding: 10px;
}
#paving_photo {
float: right;
margin: 10px 0 10px 10px;
border: 2px solid black;
width: 300px;
height: 300px;
}
.content:after {
content: "";
display: block;
height: 0;
clear: both;
}
This is the page: website template
I have tried the clearfix hack and micro hack. I have added the clearfix to the content class. I have tried overflow: hidden|auto. I have tried adding the clear: both after the floating element. Literally nothing as worked.
I'm at my wits end. Please help!
Thanks!
It seems fine on FF on my end, with the exception being when the screen height is less than about 791px. I think this is due to .outercontainer height is set to height:100%.

How can I prevent div overflow with container width 100%

I am trying to find a neat way to get my header to have a width of 100% (so I can use a background colour that spreads across the whole page), but also within it I have two images, that I'd like to stay inline and not overflow on each other or push each other down.
I currently have the follow CSS:
header {
width: 100%;
height: 150px;
padding: 50px 50px 10px 50px;
clear: both;
background: #185f96;}
#logo {
float: left;
width: 800px;}
#phone { float: left; width: 200px; }
Logo and phone are inside the header. If you look at it in action (removed) you can see if you size it down to a certain point, the phone info gets pushed under the banner. I can set it to a static width, but then this is an issue with different web sizes.
I created an extra div inside the header in which I just put the logo, and left the phone on the outside. This gives me the results I want, but I want wondering if there was a neater way of achieving this without the extra div.
(Also sorry for the formatting of the code section, I have trouble getting it to be neatly formatted. Doesn't seem to work properly)
Reduce your page with and use % unit in padding too as.
header {
width: 84%;
height: 150px;
padding: 5% 5% 1% 5%;
clear: both;
background: #185f96;}
#logo {
float: left;
width: 800px;}
Set width is percentage and then add white-space:nowrap; to header to prevent things from to a new line
header {
width: 100%;
height: 150px;
padding: 50px 50px 10px 50px;
clear: both;
background: #185f96;
white-space:nowrap; /*added*/
}
#logo {
float: left;
display:inline-block; /* or width in percentage */
}
#phone {
float: left;
min-width: 20%; /* ammended */
}

Middle of the page moves to the right when i change the page

I made a site with pictures and when i enter on the picture page and ...click on Next, Preview pictures the picture float to right. In IE work well but in Google Chrome, Mozilla,Safari ...the middle page float to right.
I tried change in css but nothink .You can help me pls?
Thanks in advance !
The class "content" i put in header and the css code
body {
/*background-color: none;
border-radius: 25px;
background-image:url('/images/gray_jean.png');*/
background: #ffffff;
color: #000000;
margin:0;
padding:0;
}
.content {
position:relative;
margin:0 auto;
margin-left: auto;
margin-right: auto;
text-align: center;
width:100%;
clear: both;
}
Thanks
Replace your current code to this,
.content {
margin:0 auto;
text-align: center;
width:100%;
}
Remove the position:relative; from the .content.
.content {
position:relative; // Remove this
}
And try, may be?

Divs and vertical centering images inside divs

I'm new to working with divs, so I'm not too good at using them. I'm making a music blog, and I want the user to be able to see the picture for the post, and arrows on either side to go to next or previous posts. I'm having trouble centering the arrows in my parent div.
I searched a few things online, but nothing seemed to work. Here is my css for a simple test...
#picture_wrapper {
width:550px;
background-color:#00F;
float:left;
}
#picture_container {
width: 500px;
float: left;
padding-left:5px;
padding-right:5px;
}
#left_arrow_container {
float: left;
top:50%;
width: 20px;
height:100%;
background-color: #F00;
}
#right_arrow_container {
float: right;
top:50%;
width: 20px;
height:100%;
background-color: #F00;
}
I set the arrow divs to have a background color of red, and I thought with this code the entire right and left sides would be red, but this is not the case. Only the area around my image is red. Here is the html that I am using.
<div id="picture_wrapper">
<div id="left_arrow_container"><img src = 'http://www.startingtofeelit.com/images/slider_left_arrow.png' width = '20' height = '34px'/></div>
<div id="picture_container"><center><img src = 'http://www.startingtofeelit.com/wp-content/uploads/2012/07/DIIV+zachacry+cole+smith2.jpg' width = '500' /></center></div>
<div id="right_arrow_container"><img src = 'http://www.startingtofeelit.com/images/slider_right_arrow.png' width = '20' /></div>
</div>
Here is how it is being displayed on my Dreamweaver now...
pic1 http://www.startingtofeelit.com/images/pic1.png
Here is how I more or less want it to be displayed...
pic2 http://www.startingtofeelit.com/images/pic2.png
Thanks for the help.
Sounds like a job for vertical-align: middle;.
http://jsfiddle.net/Wexcode/Lp5M9/2/
#picture_wrapper {
background: #F00;
float: left;
font-size: 0;
white-space: nowrap; }
#left_arrow_container, #right_arrow_container {
height: 100%;
vertical-align: middle;
display: inline-block; }
#picture_container {
background: #00F;
padding: 0 5px;
vertical-align: middle;
display: inline-block; }
​
Let me know if you have any questions.
I prefer using absolute and relative position :), pretty much what I saw you were trying to achieve in your css, in order to top, left, right and bottom to work you must set a position (absolute, relative or fixed) and use your arrows as backgrounds
http://jsfiddle.net/wQqfp/2/

Resources