Reputation: 1022
In my title I am trying to have two images on both sides of the text. I have tried a few methods, but none have worked. Here is my live website. I would like to have the icons also automatically resize based on the window size. Any help is greatly appreciated.
Related code here:
<img style="width: 15px; height: 15px;" align="left" src="favicon.ico">
<p align="middle" class="rusty"> RedstoneGaming </p>
<img style="width: 15px; height: 15px;" align="right" src="favicon.ico">
var rick = false;
var audio = new Audio('rick_roll.mp3');
var kkeys = [],
konami = "38,38,40,40,37,39,37,39,66,65,13";
$(document).keydown(function(e) {
kkeys.push(e.keyCode);
if (kkeys.toString().indexOf(konami) >= 0) {
kkeys = []; // <-- Change here
if (rick == false) {
rick = true;
audio.play();
} else if (rick == true) {
rick = false;
audio.pause(); // <-- another issue
}
}
});
/*Some Fonts Here:*/
@font-face { font-family: Rusty; src: url('BrushScriptStd.otf');}
* {
font-family: Rusty;
font-weight: Lighter;
}
.background
{
background-image: url(0.jpg);
background-attachment: fixed;
background-size: 100% auto;
background-color: f7f7f7;
background-repeat: no-repeat;
background-position:absolute;
}
.menubar {
position: relative;
height: 2.8vw;
opacity: 0.85;
background-color: #CCCCCC;
z-index: 1;
}
.clearfix:after {
display: block;
clear: both;
}
.menu-wrap {
width: 50%;
box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.2);
background: #3e3436;
}
.menu {
width: 100%;
margin: 0px auto;
text-align: center;
}
.menu li {
margin: 0px;
list-style: none;
font-family: 'Ek Mukta';
}
.menu a {
transition: all linear 0.15s;
color: #919191;
}
.menu li:hover > a,
.menu .current-item > a {
text-decoration: none;
color: rgba(189, 34, 34, 1);
}
.menu .arrow {
font-size: 0.95vw;
line-height: 0%;
}
.menu > ul > li {
float: middle;
display: inline-block;
position: relative;
font-size: 1.2vw;
}
.menu > ul > li > a {
padding: 0.7vw 5vh;
display: inline-block;
text-shadow: 0px 1px 0px rgba(0, 0, 0, 0.4);
}
.menu > ul > li:hover > a,
.menu > ul > .current-item > a {
background: #2e2728;
}
.menu li:hover .sub-menu {
display: block;
}
.sub-menu {
width: 100%;
padding: 0px 0px;
position: absolute;
top: 100%;
left: 0px;
display: none;
transition: opacity linear 5.8s;
box-shadow: 0px 2px 3px rgba(0, 0, 0, 0.2);
background: #2e2728;
}
.sub-menu li {
display: block;
font-size: 1.2vw;
}
.sub-menu li a {
padding: 10px 10px;
display: block;
}
.sub-menu li a:hover, .sub-menu .current-item a {
background: #3e3436;
}
.Rusty
{
font-family: "Rusty";
color: rgba(189, 34, 34, 1);
}
.content
{
opacity: .85;
position: relative;
margin: auto;
width: 80%;
z-index: 0;
background-color: #CCCCCC;
padding: 10px;
height: 100%;
}
.menu > ul > .login
{
position: absolute;
top: 0;
right: 0;
}
.video-container {
position:relative;
padding-bottom: 5%;
padding-top: 30px;
width: 100%;
border-bottom: thick solid rgba(189, 34, 34, 1);
}
.video-container iframe, .video-container object, .video-container embed {
position: relative;
top:15%;
left:15%;
right:15%;
width: 25vw;
height:25vh;
}
.title
{
text-align: center;
font-size: 7vh;
text-decoration: underline;
-moz-text-decoration-color: inherit;
text-decoration-color: inherit;
}
.feed-column
{
width: 50%;
height: 100%;
}
.border-right
{
border-right: thick solid rgba(189, 34, 34, 1);
}
.text-center
{
text-align: center;
}
.footer
{
background: #CCCCCC;
position:fixed;
bottom:0px;
height: 50px;
width: 100%;
opacity: .85;
}
<html>
<head>
<meta name="generator"
content="HTML Tidy for HTML5 (experimental) for Windows https://github.com/w3c/tidy-html5/tree/c63cc39" />
<link rel="stylesheet" type="text/css" href="style.css" />
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="http://s.ytimg.com/yts/cssbin/www-subscribe-widget-webp-vflj9zwo0.css" name="www-subscribe-widget" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="script.js"></script>
<link rel="shortcut icon" href="favicon.ico" />
<title>RG - Home</title>
</head>
<body class="background">
<div class="menubar">
<nav class="menu">
<ul class="clearfix">
<li>
<a href="aboutme.html">About Me
<span class="arrow">▼</span></a>
<ul class="sub-menu">
<li>
<a href="#">Gaming</a>
</li>
<li>
<a href="#">Programming</a>
</li>
<li>
<a href="#">YouTube</a>
</li>
<li>
<a href="#">Other</a>
</li>
</ul>
</li>
<li>
<a href="schedule.html">Schedule</a>
</li>
<li class="current-item">
<a href="#"><!--Here is where-->
<img style="width: 15px; height: 15px;" align="left" src="favicon.ico"><p align="middle" class="rusty"> RedstoneGaming </p><img style="width: 15px; height: 15px;" align="right" src="favicon.ico">
</a><!---------->
</li>
<li>
<a href="equipment.html">Equipment</a>
</li>
<li>
<a href="contact.html">Contact Me</a>
</li>
<li class="login">
<a href="login.html">Login/Sign Up</a>
</li>
</ul>
</nav>
</div>
<div class="content">
<h1 class="rusty title">ThatRedstoneGuy's Feed</h1>
<div class="border-right feed-column">
<h1 style="font-size: 3vh;" class="rusty text-center">Colortone | Am I colorblind?! | W/Voiceless</h1>
<div class="video-container">
<iframe src="https://www.youtube.com/embed/-egJP-2ShRk?controls=2%20align="></iframe>
</div>
</div>
<div class="feed-column">
</div>
</div>
<div class="footer">vv</div>
</body>
</html>
Upvotes: 1
Views: 55
Reputation: 17954
There are plenty of methods, each width some pros and cons.
If you need maximum possible browser compatibility, use:
The markup:
<table>
<tr>
<td><img src="path/to/img"></td>
<td><p>This is text</p></td>
<td><img src="path/to/img"></td>
</tr>
</table>
the CSS:
table{
width: 100%; border: none;
border-spacing: 0;
border-collapse: collapse;
text-align: center
}
table img, table p{
display: inline
}
If you have some flexibility on browser compatiility, you may choose the inline-block method:
The markup:
<div class="parent">
<img src="path/to/img"><!--
--><p>This is text</p><!--
--><img src="path/to/img">
</div>
the CSS:
.parent{
text-align: center
}
img, p{
display: inline-block;
vertical-align: middle
}
Upvotes: 1
Reputation: 757
just change you code
<a href="#"><!--Here is where-->
<img style="width: 15px; height: 15px;" align="left" src="favicon.ico"><p align="middle" class="rusty"> RedstoneGaming </p><img style="width: 15px; height: 15px;" align="right" src="favicon.ico">
</a><!---------->"
to
<div>
<div class="left">
<img style="width: 15px; height: 15px;" align="left" src="favicon.ico">
</div>
<div class="middle">
<a href="#" align="middle" class="rusty"> RedstoneGaming </a> </p>
</div>
<div class="right">
<img style="width: 15px; height: 15px;" align="right" src="favicon.ico">
</div>
<div class="clearfix"></div>
<style>
.left{
float:left;
}
.middle{
float:left;
}
.right{
float:left;
}
.clearfix{
clear:both;
}
</style>
Upvotes: 1
Reputation: 6480
make p
tag inline
.
.rusty {
font-family: "Rusty";
color: rgba(189, 34, 34, 1);
display: inline;
}
Upvotes: 2
Reputation: 553
try this code:
.menu li.current-item {
float:none;
width:100%;
}
Upvotes: 1