I've got the following...
<div id="nav-above" class="navigation">
<div class="nav-previous"><span class="meta-nav">«</span> title</div>
<div class="nav-next">title <span class="meta-nav">»</span></div>
</div><!– #nav-above –>
using external CSS alone is it possible to force all of that to remain on just one line?
Try this: http://jsfiddle.net/dT49F/
HTML:
<div class="container">
<div id="nav-above" class="navigation">
<div class="nav-previous">
<a href="link" rel="prev">
<span class="meta-nav">«</span>
much much longer link title here and here and here
</a>
</div>
<div class="nav-next">
<a href="link" rel="next">
much much longer link title here and here and here
<span class="meta-nav">»</span>
</a>
</div>
</div>
</div>
CSS:
.container div {
display: inline;
white-space: nowrap;
}
Any reason for the inner DIVs? I'd just drop them - and if you need the classes, assign them directly to the links:
<div id="nav-above" class="navigation">
<span class="meta-nav">«</span> title
title <span class="meta-nav">»</span>
</div><!– #nav-above –>
div[class^=nav-] {
float: left;
}
That should work. Please note my snippet is using CSS3 selectors, so it might not work in less-advanced browsers. Provide the same class to both divs, and then you can use normal selectors.
UPDATE:
This won't work in IE6, unless you do something like this:
<div id="nav-above" class="navigation">
<div class="nav-previous navigation-links"><span class="meta-nav">«</span> title</div>
<div class="nav-next navigation-links">title <span class="meta-nav">»</span></div>
</div><!– #nav-above –>
(Notice the new class .navigation-links)
And then just change the css selector:
div.navigation-links {
float: left;
}
Related
I want to separate find an event and post an eventand put them on the same line below Events
Html:
<div class="lasvegas">
Events</div>
<div class="findanevent"> </div>
<div class="event_wrapper"><a href="https://adsler.co.uk/find-an-
event/"><span id="findanevent" class="event">Find an Event</span>.
</a>
<a href="https://adsler.co.uk/post-an-event/"><span id="postanevent"
class="event">Post an Event</span></a></div>
Page:https://adsler.co.uk/events/
Tried css .events {display: block;} didn't work
This worked in mobile but how to replicate in desktop?
.event {float :right;} .findanevent br {display: none;}
.event_wrapper {
text-align: center;
margin-top: 20px;
}
<div class="lasvegas" style="text-align: center">
Events
</div>
<div class="event_wrapper">
<div>
<span id="findanevent" class="event">Find an Event</span>
</div>
<div>
<span id="postanevent" class="event">Post an Event</span>
</div>
</div>
I've a html page with two span tag's which displays the same content but nested in a div with different class name:
<div class='class1'>
<span class='test-icon'>1</span>
</div>
<div class='class2'>
<span class='test-icon'>2</span>
</div>
Is there a way i can show only one <span> at a time based on the nested class, e.g. i've tried with the div.class1 span.test-icon {display: none}but it hides both.
You didn't close your span tags!
Here you are:
.class1 .test-icon{
display: none;
}
/*.class2 .test-icon{
display: none;
}*/
<div class='class1'>
<span class='test-icon'>Hola</span>
</div>
<div class='class2'>
<span class='test-icon'>Adios</span>
</div>
This seems to work as it should:
div.class1 span.test-icon {display:none;}
<div class='class1'>
<span class='test-icon'>Span 1</span>
</div>
<div class='class2'>
<span class='test-icon'>Span 2</span>
</div>
I have some HTML/CSS that looks something like this:
#left a:hover img {
border: 5px solid red;
}
<div id="information">
<div id="left">
<a href="URL">
<img src="IMG">
<span id="button">CLICK</span>
</a>
</div>
<div id="right">
CLICK
</div>
</div>
I want to make it so that when you hover over either link, a CSS rule is applied to the image in left. I can get the link on the left, but not the right.
I want to make it so that all hovering over any links in "#information" will apply this rule to any image that fits "#information #left a img". What's the best way to do this? Is there a way to do it in one line?
We weren't able to figure out how to do this with exclusively CSS, therefore see below for a jquery alternative.
(function(){
$('#information').find('a').each(function(i, element){
$(element).mouseover(function(){
$('#left img').addClass("hoveredThing");
});
$(element).mouseleave(function(){
$('#left img').removeClass("hoveredThing");
});
});
}());
.hoveredThing { border:5px solid red; }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="information">
<div id="left">
<a href="URL">
<img src="img" >
<span id="button">CLICK</span>
</a>
</div>
<div id="right">
<a href="URL">
CLICK
</a>
</div>
</div>
This doesn't work because of the structure of your html. You are saying to select the img inside the hovered "a" tag. You need the img outside of the "a" and use a sibling selector.
A fiddle
https://jsfiddle.net/05jwnw7v/
#information a:hover~img{border: 1px solid red;}
<div id="information">
<div id="NewContainer">
CLICK
<a href="URL">
<span id="button">CLICK</span>
</a>
<img src="IMG" >
</div>
</div>
try this
#information div a:hover img{border:5px solid red;}
I have a center div and a simple problem...
I don't know how to place a image right to it relative(!) like this:
<div class="text_middle">
<span class="volat_text">App</span>
<div id="sport_dropdown">
<span id="sport">Test</span>
</div>
</div>
<img id="arrow_down" src="img/arrow_down.png">
Here is the code: http://codepen.io/lalaluki/pen/pNNYpZ
Does somebody knows a trick?
You can place something like <span>▾</span> inside your .text_middle element. I used the html symbol code for a downside triangle because you did not provide the image in your pen example. But you can try it with an image or glyphicon instead.
<div class="text_middle">
<span class="volat_text">App</span>
<div id="sport_dropdown">
<span id="sport">Test</span>
</div>
<span>▾</span>
</div>
See the pen here
.vertical_align{
vertical-align:middle;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div id="top_bar">
<div class="text_middle">
<span class="volat_text">App</span>
<div id="sport_dropdown">
<span id="sport">Test</span>
<span class="glyphicon glyphicon-chevron-down vertical_align" ></span>
</div>
</div>
Try this.
Hope this helps.
I would apply float:right to the image:
#arrow_down {
float:right;
}
Need to change your HTML Structure to achieve this quickly. Add image inside '.text-middle' div
<div class="text_middle">
<span class="volat_text">App</span>
<div id="sport_dropdown">
<span id="sport">Test</span>
</div>
<img id="arrow_down" src="img/arrow_down.png">
</div>
Add vertical align middle to your image
#arrow_down {
vertical-align: middle;}
Hope this will help you
I am designing a website for software created by my self. For this, I need a layout in which three boxes are on the same horizontal position. But as I put text in those they start shifting.
What might be the possible cause?
<body class="metro">
<nav class="navigation-bar">
<nav class="navigation-bar-content">
<div class="element">My Software Name</div>
<span class="element-divider"></span>
<a class="element place-right" href="#">Download</a>
</nav>
</nav>
<div class="slideImage"></div>
<div class="about">
<div class="infoBar">
<h2>What is ?</h2>
<span class="paragraph">
this is example text to illustrate the real problem regardig the info bar alingment
</span>
</div>
<div class="infoBar"><h2>Why this ?</h2>
<span class="paragraph">
</span>
</div>
<div class="infoBar"><h2>About</h2></div>
</div>
</body>
Here is full Scree Example
You could do it by set the vertical-align:top; to .infoBar to remove the vertical whitespace between inline-block elements.
JSFiddle - DEMO
CSS:
.infoBar {
vertical-align:top;
}