I want my header to look like this:
Link | Link | Link Image
-----------------------------------------------------------------------
What I have instead is:
Link | Link | Link
-----------------------------------------------------------------------
Image
ASP code:
<div class="hideSkiplink">
<asp:Menu ID="NavigationMenu" runat="server" EnableViewState="False" IncludeStyleBlock="true" Orientation="Horizontal" >
<Items>
<asp:MenuItem NavigateUrl="~/Default.aspx" ImageUrl="~/ICONS/About/home_Icon.png"/>
<asp:MenuItem NavigateUrl="~/About.aspx" ImageUrl="~/ICONS/About/about_Icon.png"/>
<asp:MenuItem NavigateUrl="~/RestrictedPages/AdminMenu.aspx" ImageUrl="~/ICONS/About/admin_Icon.png"></asp:MenuItem>
</Items>
</asp:Menu>
<div class="logo">
<asp:Image ID="Image1" runat="server" ImageUrl="~/ICONS/About/logo.png" />
</div>
</div>
CSS:
div.hideSkiplink {
background-color: #3a4f63;
width: 100%;
}
div.logo {
float: right;
}
Inspecting the element in Firebug shows:
<div class="hideSkiplink">
<a href="#NavigationMenu_SkipLink">
<div id="NavigationMenu" style="float: left;">
<div style="clear: left;"></div>
I think the div with clear: left is being created automatically and that is what is causing the issue.
What can be done to prevent this element from being created or is there a workaround to compensate for its inclusion?
The correct, and complete, answer is:
1) add, as "musium" commented, the following to your CSS
#IDOfYourMenuControl + div {
clear: none !important;
}
This will stop the unexpected
<div style="clear: left";></div>
2) add the following to your asp.menu tag
SkipLinkText=""
This will stop the unexpected
<a id="yourmenuID_SkipLink">
tag from being created.
You're welcome. :-)
Arrange your divs properly
e.g.
<div id="dvParent">
<div style="float:left">
Link | Link | Link
</div>
<div style="float:right">
Image
</div>
<div style="clear:both;"></div>
</div>
http://jsfiddle.net/PhKhg/
I know this question is very old… but I’ve just had the same problem and for me, the following solution worked:
#IDOfYourMenuControl + div {
clear: none !important;
}
nav div:nth-child(a number){
clear:none !important;
}
Related
I have a markup which contains div with some images as shown. Currently each section of div appears vertically. But, i want to show the items on left & text on right as shown in screen dump.
HTML Markup:
<div id="divgetpaidnow" style="float:none;width:200px;" class="paymentclass" paytype="GetPaidNow" paytypeid="1">
<asp:Image ID="Image1" src="images/getpaidnow.jpg" runat="server" class="paymentimg" />
<div>
</div>
<asp:RadioButton ID="rdo1" Text="Get Paid Now" runat="server" class="myradio" GroupName="rdoPaymentgroup" />
<div class="payTypeFooterText" style="float:none;"> <strong>Get Paid Now:</strong><br />
Instant Cash, visit one of our Mall Locations and get Paid Today
</div>
</div>
<div id="divamazon" style="float: none;" class="paymentclass" paytype="Amazon" paytypeid="2">
<asp:Image ID="Image2" src="images/amazon.jpg" runat="server" class="paymentimg" />
<div style="margin-top: 10px;">
</div>
<asp:RadioButton ID="rdo2" Text="Recommended" runat="server" class="myradio" GroupName="rdoPaymentgroup" />
<div class="payTypeFooterText">
<strong>Amazon Gift Card:</strong><br />
Get paid quickly via electronic gift card and receive an extra 5%</div>
</div>
css:
.payTypeFooterText
{
width: 120px;
font-style: normal;
font-size: 10px;
}
.myradio
{
color: grey;
font-size: 12px;
text-decoration: none;
}
Just these two css other class names are used for accessing elements using JQUERY.
Help Appreciated!
You can use css property float to align content on pages
<div>
<div style='float:left;'>
----content---
</div>
<div style='float:right;'>
----content---
</div>
</div>
Have a common class for all the divs and use display:inline-block
div{
display:inline-block;
background:red;
}
DEMO
i'm trying to get this working but i cant figure out why it wont, is there a way of troubleshooting this i.e to see errors
What i am trying to achieve is to show the info in the showhim div when i hover over the stat1 div but it aint happening.
I put it here:
http://jsfiddle.net/ksvrY/39/
<div id="post-wrap">
<div class="showhim" id="stat1_text">
This is some example test<br />
This is another line<br />
And another one<br />
And a final one
</div>
<div id="stat1" class="stat1">
Hover over this div
</div>
</div>
.showhim
{
display: none;
margin-bottom: 30px;
}
.stat1:hover .showhim
{
display: block;
}
Edit: As pointed out by Paul, you can use the sibling selector. So there is actually a way to do this with pure css in this case
.stat1 is not a parent of .showhim.
You can use javascript. So something like (using jQuery):
$('.stat1').mouseover(function(){
$('.showhim').show();
}).mouseout(function(){
$('.showhim').hide();
});
See http://jsfiddle.net/ksvrY/50/
You could do a sibling select.
<div id="post-wrap">
<div id="stat1" class="stat1">
Hover over this div
</div>
<div class="showhim" id="stat1_text">
This is some example test<br />
This is another line<br />
And another one<br />
And a final one
</div>
.showhim
{
display: none;
margin-bottom: 30px;
}
.stat1:hover ~ .showhim
{
display: block;
}
For it to work, the .showhim needs to be a child element of .stat1.
agree with paul
and here's another solution:
move .showhim into #stat1:
<div id="post-wrap">
<div id="stat1" class="stat1">
Hover over this div
<div class="showhim" id="stat1_text">
This is some example test<br />
This is another line<br />
And another one<br />
And a final one
</div>
</div>
</div>
What I am trying to do is be able to have two columns in a div. So I can insert a picture at any point, and place text long side it neatly.
Here is my html:
<div id="content">
<div id="gallery">
<h1>Gallery</h1>
<div id="container">
<div id="imageleft">
<img src="images/pic1.jpg" width="150px" alt="Image" />
</div>
<div id="imageright">
test
</div>
</div>
<img src="images/pic2.jpg" width="150px" alt="Image" />
<img src="images/pic3.jpg" width="150px" alt="Image" />
<img src="images/pic4.jpg" width="150px" alt="Image" />
</div>
</div>
Here is a perfect working JSFiddle
http://jsfiddle.net/RdyGM/1/
And here is an image of what I actually see. The purple bit should be 50% of left. (The text "test" is placed below).
upon inspection you can see that it is obtaining its width from else where :#
How to use just my desired css.
Well, there are two things you could do. The general approach is to try to make your CSS selector more specific. So you could do: #gallery #content #imageleft, instead of just #imageleft, and that should make your rule apply. The other approach is to change your CSS #imageleft to say:
#imageleft{
....
width:50% !important;
....
}
You can use !important to tell the browser which CSS to prioritise - it might, or might not help...
#imageleft {
float:left;
width:50% !important;
background:#c9c;
}
#imageright {
float:right;
width:50% !important;
background:#9c9;
}
domId.Attributes.Add("property of css", "Your css class name");
I have a little problem with my site, I have a bar and on it a box that float above the bar, everything works fine in IE, Firefox, Opera, but in Chrome and Safari the box that must be above the bar float by the bar side no above it.
#barraDerecha
{
width:240px;
background-color:#e5e5e5;
border-left:solid 2px #CCC;
border-bottom:solid 2px #CCC;
position:absolute;
margin-top:-10px;
margin-left:717px;
height:auto;
}
#barraDerecha #menu
{
display:block;
position:fixed;
width:220px;
}
barraDerecha is the container and menu is the box that goes above the container
Can somebody help me please?
Thanks in advance
Just in case someone is getting the same chrome behaviour.
It looks like chrome considers that the viewport of an element added to the DOM after the page is loaded (for instance, using jQuery.load()) is restricted to the containing div of this element.
I guess .asp is injecting your barraDerecha after document load, so it positions relative to its container.
Thanks for u answer Thor you can see the example in www.autos.ultimahora.com/altaanuncio.html
I can't put fixed to #barraderecha cause in that way my bar move with the menu
Here is who I use the class:
<div id="barraDerecha" >
<div id="barraRight" runat="server">
<div style="padding:10px;" id="menu" >
<div class="titulosAzules15">
<center>
<asp:Label ID="lblUsted" runat="server" Text="USTED ELIGÍO EL PLAN"></asp:Label>
<br />
<br />
<asp:Image ID="imgPlan" runat="server" />
<br />
<asp:Label ID="lblPrecio" CssClass="DestaquesBordo14" runat="server"></asp:Label>
<br />
</center>
</div>
</div>
</div>
</div>
You have to select a plan and then push on Siguiente button
Pardon me, but isn't #menu within #barraDerecha?
If so, it would only be natural that it would be fixed within #barraDerecha unless you specify the position furthermore.
#barraDecha {
position:fixed; top:0; left:0; }
A better description (perhaps a visual) would help i terms of describing the problem more accurately.
Here is the code sample
<div class="Layouts">
<asp:ContentPlaceHolder ID="Center" runat="server" />
<asp:ContentPlaceHolder ID="PlaceHolderMain" runat="server" />
<p> </p>
</div>
The CSS that styles the Layouts div is
.Layouts
{
background-color: White;
margin-top: 17px;
padding-top: 18px;
}
Nothing to crazy there!
The problem I am having is that without the "<p> </p>" the white background does not fill down behind whatever I put in the two ContentPlaceHolders (and no they don't have an over riding background!)
With the <p> </p> it all works as I wish... but not as I expect!
Am I doing something wrong or is it a browser or a Sharepoint issue? Is there a better fix than the space?
Is the ContentPlaceHolder's floated?
If so, try adding: overflow:hidden; to the .Layouts selector.