• 0

CSS Div alignment


Question

What I am trying to achieve is to have 2 bookends and both sides of the screen in the middle will be books On to of the books will be the logo

 

I would link to the code but the web server is offline for upgrades

<style>
.threecol {
width:100%;
overflow:hidden;
}
.threecol div {
float:left;
width:33%;
}
#left
{
	width:9px;
}
	#right
{
	width:9px;
}

#middle
{
	
	background-image: url('middle.jpg');
}
</style>
<div class="threecol">
<div id="left" align="left"  ><img src="left.jpg" width="9" height="90"></div>
<div id="middle" align="center"><img src="logo.jpg" width="9" height="90"></div>
<div id="right" align="right"><img src="right.jpg" width="9" height="90"></div>
</div>

post-178294-0-74098600-1408682969.jpg

post-178294-0-84470700-1408682976.jpg

post-178294-0-59448100-1408682986.jpg

post-178294-0-84068900-1408682993.jpg

Link to comment
https://www.neowin.net/forum/topic/1226625-css-div-alignment/
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Don't use the align attribute on div tags.

Float the left and right divs.

Remove the middle div.

Assign the bakcground-image style to the treecol div.

Move the logo image in to the threecol div.

You can make the logo image appear in the center by setting the "text-align: center" style to the treecol div.

  • 0


<!doctype html>

<html>

<head>

<style type="text/css">

body{

margin:0px;

padding:0px;

}

.a { /* http://www.css3.info/preview/multiple-backgrounds/ */

background-image:url('bcl.png'),url('bcr.png'),url('bcm.png

background-position:left,right,center;

background-repeat:no-repeat,no-repeat,repeat-x;

height:100px; /* should be multiples of background height */

min-width:81px; /* so that min-width is at least background width */

overflow:hidden;

}

.a p{ /* dummy text */

margin:25px 35px;

padding:0px;

}

</style>

</head>

<body>

<div class="a"><p>Hello World and all of your books.</p></div>

</body>

</html>

This topic is now closed to further replies.
  • Posts

    • Running Qbittorrent 5.1.0 on Win11 just fine.
    • I love this game since its first version and it seems that it's only getting better!
    • Oh my goooooooooooooooooooooooooood!!!!!!!!!!!!!!!!!!!!!!!!!!! Yes!!! Super Resident Evil fan here, in case you didn't notice 😅. And Raccoon City is my favorite setting in the entire RE universe. This is a dream come true.
    • Just found this Taskbar Buddy program (still in beta) - 'It lets you turn literally any GIF into your own personal desktop pet.  Thought I would throw some more eyes onto it, (I'm not involved just sharing) https://orange-boy-0.itch.io/taskbar-buddy  
    • Resident Evil Requiem announced for early 2026, taking the story back to Raccoon City by Pulasthi Ariyasinghe The Summer Game Fest showcase today ended with a bang as Capcom delivered the announcement trailer for its next mainline Resident Evil game, finally showing off what it has in store for the ninth entry. Aptly dubbed Resident Evil Requiem, the game is described as a "heart-stopping experience that will chill you to your core." Watch the newly revealed announcement trailer above. The single-player horror game will follow Grace Ashcroft as a protagonist, an FBI agent investigating a series of unusual murders at a hotel named the Remnant Hotel, all linked to her mother's mysterious death. While a new face to the series, she may be related to a character from another Resident Evil game, Outbreak, from back in the day, though Capcom is yet to confirm any ties just yet. Rumors have suggested that Leon is returning in this entry as a playable character too, but the debut trailer did not drop any hints about this project being a dual-protagonist adventure. "A new era of survival horror begins in 2026," says Capcom regarding its latest Resident Evil experience. "Technological advancements combined with the development team's depth of experience combine in a story with rich characters and gameplay that's more immersive than ever before." It looks like the title is returning to its survival horror roots after going for more action-orientated entries in recent times. The original Raccoon City seems to be the setting again too, letting players return to ground zero of the virus outbreak, just in time for the series to hit its 30th anniversary. Resident Evil Requiem is launching across PC, Xbox Series X|S, and PlayStation 5 on February 27, 2026.
  • Recent Achievements

    • Week One Done
      daelos earned a badge
      Week One Done
    • One Month Later
      daelos earned a badge
      One Month Later
    • Mentor
      Karlston went up a rank
      Mentor
    • One Month Later
      EdwardFranciscoVilla earned a badge
      One Month Later
    • One Month Later
      MoyaM earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      492
    2. 2
      snowy owl
      254
    3. 3
      +FloatingFatMan
      252
    4. 4
      ATLien_0
      215
    5. 5
      Xenon
      152
  • Tell a friend

    Love Neowin? Tell a friend!